projects
/
dss.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
9c4bc98
)
Fix wait_pro_process().
author
Andre Noll
<maan@systemlinux.org>
Fri, 21 Mar 2008 12:42:02 +0000
(13:42 +0100)
committer
Andre Noll
<maan@systemlinux.org>
Fri, 21 Mar 2008 12:42:02 +0000
(13:42 +0100)
The old code was racy.
dss.c
patch
|
blob
|
history
diff --git
a/dss.c
b/dss.c
index
d77fef2
..
8b8e4bb
100644
(file)
--- a/
dss.c
+++ b/
dss.c
@@
-383,10
+383,14
@@
int wait_for_process(pid_t pid, int *status)
DSS_DEBUG_LOG("Waiting for process %d to terminate\n", (int)pid);
for (;;) {
DSS_DEBUG_LOG("Waiting for process %d to terminate\n", (int)pid);
for (;;) {
- pause();
- ret = next_signal();
+ fd_set rfds;
+
+ FD_ZERO(&rfds);
+ FD_SET(signal_pipe, &rfds);
+ ret = dss_select(signal_pipe + 1, &rfds, NULL, NULL);
if (ret < 0)
break;
if (ret < 0)
break;
+ ret = next_signal();
if (!ret)
continue;
if (ret == SIGCHLD) {
if (!ret)
continue;
if (ret == SIGCHLD) {
@@
-1096,6
+1100,7
@@
int main(int argc, char **argv)
cmdline_parser_ext(argc, argv, &conf, ¶ms); /* aborts on errors */
parse_config_file(0);
cmdline_parser_ext(argc, argv, &conf, ¶ms); /* aborts on errors */
parse_config_file(0);
+
if (conf.daemon_given)
daemon_init();
setup_signal_handling();
if (conf.daemon_given)
daemon_init();
setup_signal_handling();