Exemple #1
0
/* process an email request and free the record */
static void _mail_proc(mail_info_t *mi)
{
	pid_t pid;

	pid = fork();
	if (pid < 0) {		/* error */
		error("fork(): %m");
	} else if (pid == 0) {	/* child */
		int fd;
		(void) close(0);
		(void) close(1);
		(void) close(2);
		fd = open("/dev/null", O_RDWR); // 0
		if(dup(fd) == -1) // 1
			error("Couldn't do a dup for 1: %m");
		if(dup(fd) == -1) // 2
			error("Couldn't do a dup for 2 %m");
		execle(slurmctld_conf.mail_prog, "mail",
			"-s", mi->message, mi->user_name,
			NULL, NULL);
		error("Failed to exec %s: %m",
			slurmctld_conf.mail_prog);
		exit(1);
	} else {		/* parent */
		waitpid(pid, NULL, 0);
	}
	_mail_free(mi);
	return;
}
static void
_gc_shutdown (E_Gadcon_Client * gcc)
{
  Instance *inst;

  inst = gcc->data;

  if (inst->check_timer)
    ecore_timer_del (inst->check_timer);
   
  evas_object_event_callback_del (inst->mail_obj, EVAS_CALLBACK_MOUSE_DOWN,
				  _mail_cb_mouse_down);
  evas_object_event_callback_del (inst->mail_obj, EVAS_CALLBACK_MOUSE_IN,
				  _mail_cb_mouse_in);
  evas_object_event_callback_del (inst->mail_obj, EVAS_CALLBACK_MOUSE_OUT,
				  _mail_cb_mouse_out);

  if (inst->popup) e_object_del (E_OBJECT (inst->popup));
  mail_config->instances = eina_list_remove (mail_config->instances, inst);
  _mail_free (inst->mail);
  free (inst);
  inst = NULL;
}