summaryrefslogtreecommitdiff
path: root/sys-utils
diff options
context:
space:
mode:
authorLaMont Jones <lamont@debian.org>2009-12-21 22:13:51 -0700
committerLaMont Jones <lamont@debian.org>2009-12-21 22:13:51 -0700
commitb5b9321c3bee43fc723e865ebafe6d7f7d56b831 (patch)
tree8502318f04cd0293d515c09b8e940467da01a464 /sys-utils
parent6e3d11e663f4d57f3b41ce670565821ed6f8dd67 (diff)
parent387ade2a24cc6fd13e8b5db123c4fa47f430948d (diff)
downloadutil-linux-old-b5b9321c3bee43fc723e865ebafe6d7f7d56b831.tar.gz
Merge remote branch 'origin/master'
Diffstat (limited to 'sys-utils')
-rw-r--r--sys-utils/flock.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/sys-utils/flock.c b/sys-utils/flock.c
index a53f6d31..75c007c7 100644
--- a/sys-utils/flock.c
+++ b/sys-utils/flock.c
@@ -287,6 +287,8 @@ int main(int argc, char *argv[])
if ( cmd_argv ) {
pid_t w, f;
+ /* Clear any inherited settings */
+ signal(SIGCHLD, SIG_DFL);
f = fork();
if ( f < 0 ) {
@@ -304,9 +306,15 @@ int main(int argc, char *argv[])
} else {
do {
w = waitpid(f, &status, 0);
+ if (w == -1 && errno != EINTR)
+ break;
} while ( w != f );
- if ( WIFEXITED(status) )
+ if (w == -1) {
+ err = errno;
+ status = EXIT_FAILURE;
+ fprintf(stderr, "%s: waitpid failed: %s\n", program, strerror(err));
+ } else if ( WIFEXITED(status) )
status = WEXITSTATUS(status);
else if ( WIFSIGNALED(status) )
status = WTERMSIG(status) + 128;