Пример #1
0
/**
 * Unmarshal server implementation specific data and update the servers state accordingly
 * 
 * On critical failure the program should `abort()` or exit by other means.
 * That is, do not let `reexec_failure_recover` run successfully, if it unrecoverable
 * error has occurred or one severe enough that it is better to simply respawn.
 * 
 * @param   state_buf  The marshalled data that as not been read already
 * @return             Non-zero on error
 */
int
unmarshal_server(char *state_buf)
{
	/* buf_get_next(state_buf, int, MDS_ECHO_VARS_VERSION); */
	buf_next(state_buf, int, 1);
	buf_get_next(state_buf, int, connected);
	buf_get_next(state_buf, uint32_t, message_id);
	fail_if (mds_message_unmarshal(&received, state_buf));
	return 0;
fail:
	xperror(*argv);
	mds_message_destroy(&received);
	return -1;
}
Пример #2
0
/**
 * Unmarshal server implementation specific data and update the servers state accordingly
 * 
 * On critical failure the program should `abort()` or exit by other means.
 * That is, do not let `reexec_failure_recover` run successfully, if it unrecoverable
 * error has occurred or one severe enough that it is better to simply respawn.
 * 
 * @param   state_buf  The marshalled data that as not been read already
 * @return             Non-zero on error
 */
int
unmarshal_server(char *state_buf)
{
	int stage = 0;

	/* buf_get_next(state_buf, int, MDS_COLOUR_VARS_VERSION); */
	buf_next(state_buf, int, 1);
	buf_get_next(state_buf, int, connected);
	buf_get_next(state_buf, uint32_t, message_id);

	fail_if (mds_message_unmarshal(&received, state_buf));
	state_buf += mds_message_marshal_size(&received) / sizeof(char*);
	stage++;

	fail_if (colour_list_unmarshal(&colours, state_buf));

	return 0;
fail:
	xperror(*argv);
	if (stage >= 0) mds_message_destroy(&received);
	if (stage >= 1) colour_list_destroy(&colours);
	return -1;
}
Пример #3
0
/**
 * Unmarshal server implementation specific data and update the servers state accordingly
 * 
 * On critical failure the program should `abort()` or exit by other means.
 * That is, do not let `reexec_failure_recover` run successfully, if it unrecoverable
 * error has occurred or one severe enough that it is better to simply respawn.
 * 
 * @param   state_buf  The marshalled data that as not been read already
 * @return             Non-zero on error
 */
int unmarshal_server(char* state_buf)
{
  int r;
  /* buf_get_next(state_buf, int, MDS_VT_VARS_VERSION); */
  buf_next(state_buf, int, 1);
  buf_get_next(state_buf, int, connected);
  buf_get_next(state_buf, uint32_t, message_id);
  buf_get_next(state_buf, int, display_vt);
  buf_get_next(state_buf, int, display_tty_fd);
  buf_get_next(state_buf, int, vt_is_active);
  buf_get_next(state_buf, struct stat, old_vt_stat);
  buf_get_next(state_buf, int, secondary_socket_fd);
  buf_get_next(state_buf, ssize_t, nonexclusive_counter);
  memcpy(vtfile_path, state_buf, PATH_MAX * sizeof(char));
  state_buf += PATH_MAX;
  r = mds_message_unmarshal(&received, state_buf);
  if (r)
    {
      xperror(*argv);
      mds_message_destroy(&received);
    }
  return r;
}