summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Haller <thaller@redhat.com>2015-05-03 13:57:16 +0200
committerThomas Haller <thaller@redhat.com>2015-05-05 10:37:19 +0200
commit64a8a8ab08e938fb7158d4f2ab7ca370ba512bfb (patch)
tree3803bafcf34d2d49d5d9d52fadc888974e8e4bb8
parent696c7335c9c32cf205afaa005c8498c4572fee33 (diff)
downloadNetworkManager-th/waitpid-bgo748885.tar.gz
dispatcher: repeat waitpid() call on EINTRth/waitpid-bgo748885
Also, no use of first trying to kill() with signal zero. Just send SIGKILL right away.
-rw-r--r--callouts/nm-dispatcher.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/callouts/nm-dispatcher.c b/callouts/nm-dispatcher.c
index 6fb40cf9f3..77f2153d62 100644
--- a/callouts/nm-dispatcher.c
+++ b/callouts/nm-dispatcher.c
@@ -294,9 +294,12 @@ script_timeout_cb (gpointer user_data)
g_warning ("Script '%s' took too long; killing it.", script->script);
- if (kill (script->pid, 0) == 0)
- kill (script->pid, SIGKILL);
- (void) waitpid (script->pid, NULL, 0);
+ kill (script->pid, SIGKILL);
+again:
+ if (waitpid (script->pid, NULL, 0) == -1) {
+ if (errno == EINTR)
+ goto again;
+ }
script->error = g_strdup_printf ("Script '%s' timed out.", script->script);
script->result = DISPATCH_RESULT_TIMEOUT;