/*
* Sylpheed -- a GTK+ based, lightweight, and fast e-mail client
- * Copyright (C) 1999-2009 Hiroyuki Yamamoto & The Claws Mail Team
+ * Copyright (C) 1999-2011 Hiroyuki Yamamoto & The Claws Mail Team
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
Children *children;
gchar *cmd;
pid_t pid;
+ gint next_sig;
gint chld_in;
gint chld_out;
gint chld_err;
if (setpgid(0, 0))
perror("setpgid");
-#ifdef GDK_WINDOWING_X11
- r = close(ConnectionNumber(gdk_display_get_default()));
-#endif /* GDK_WINDOWING_X11 */
-
gch_pid = fork();
if (gch_pid == 0) {
ACTION_USER_IN |
ACTION_USER_HIDDEN_IN)) {
r |= close(fileno(stdin));
- r |= dup (chld_in[0]);
+ (void) dup (chld_in[0]);
}
r |= close(chld_in[0]);
r |= close(chld_in[1]);
r |= close(fileno(stdout));
- r |= dup (chld_out[1]);
+ (void) dup (chld_out[1]);
r |= close(chld_out[0]);
r |= close(chld_out[1]);
r |= close(fileno(stderr));
- r |= dup (chld_err[1]); /* why does that fail ? */
+ (void) dup (chld_err[1]);
r |= close(chld_err[0]);
r |= close(chld_err[1]);
child_info->children = children;
child_info->pid = pid;
+ child_info->next_sig = SIGTERM;
child_info->cmd = g_strdup(cmd);
child_info->new_out = FALSE;
child_info->output = g_string_new(NULL);
for (cur = children->list; cur; cur = cur->next) {
child_info = (ChildInfo *)(cur->data);
debug_print("Killing child group id %d\n", child_info->pid);
- if (child_info->pid && kill(-child_info->pid, SIGTERM) < 0)
+ if (child_info->pid && kill(-child_info->pid, child_info->next_sig) < 0)
perror("kill");
+ child_info->next_sig = SIGKILL;
}
#endif /* G_OS_UNIX */
}
gssize by_read = 0, by_written = 0;
debug_print("Sending input to grand child.\n");
- if (!(cond && GDK_INPUT_WRITE))
+ if (!(cond & GDK_INPUT_WRITE))
return;
gtk_widget_set_sensitive(children->input_hbox, FALSE);