Revision 469 src/action.c
| action.c (revision 469) | ||
|---|---|---|
| 35 | 35 |
#include <string.h> |
| 36 | 36 |
#include <errno.h> |
| 37 | 37 |
#include <sys/types.h> |
| 38 |
#include <sys/wait.h> |
|
| 38 |
#if HAVE_SYS_WAIT_H |
|
| 39 |
# include <sys/wait.h> |
|
| 40 |
#endif |
|
| 39 | 41 |
#include <signal.h> |
| 40 | 42 |
#include <unistd.h> |
| 41 | 43 |
|
| ... | ... | |
| 688 | 690 |
static ChildInfo *fork_child(gchar *cmd, const gchar *msg_str, |
| 689 | 691 |
Children *children) |
| 690 | 692 |
{
|
| 693 |
#ifdef G_OS_UNIX |
|
| 691 | 694 |
gint chld_in[2], chld_out[2], chld_err[2], chld_status[2]; |
| 692 | 695 |
gchar *cmdline[4]; |
| 693 | 696 |
pid_t pid, gch_pid; |
| ... | ... | |
| 845 | 848 |
} |
| 846 | 849 |
|
| 847 | 850 |
return child_info; |
| 851 |
#else |
|
| 852 |
return NULL; |
|
| 853 |
#endif /* G_OS_UNIX */ |
|
| 848 | 854 |
} |
| 849 | 855 |
|
| 850 | 856 |
static void kill_children_cb(GtkWidget *widget, gpointer data) |
| 851 | 857 |
{
|
| 858 |
#ifdef G_OS_UNIX |
|
| 852 | 859 |
GSList *cur; |
| 853 | 860 |
Children *children = (Children *) data; |
| 854 | 861 |
ChildInfo *child_info; |
| ... | ... | |
| 859 | 866 |
if (child_info->pid && kill(-child_info->pid, SIGTERM) < 0) |
| 860 | 867 |
perror("kill");
|
| 861 | 868 |
} |
| 869 |
#endif /* G_OS_UNIX */ |
|
| 862 | 870 |
} |
| 863 | 871 |
|
| 864 | 872 |
static gint wait_for_children(Children *children) |
| ... | ... | |
| 1156 | 1164 |
c = read(source, &buf, 1); |
| 1157 | 1165 |
debug_print("Child returned %c\n", buf);
|
| 1158 | 1166 |
|
| 1167 |
#ifdef G_OS_UNIX |
|
| 1159 | 1168 |
waitpid(-child_info->pid, NULL, 0); |
| 1169 |
#endif |
|
| 1160 | 1170 |
childinfo_close_pipes(child_info); |
| 1161 | 1171 |
child_info->pid = 0; |
| 1162 | 1172 |
|
Also available in: Unified diff