aboutsummaryrefslogtreecommitdiffstats
path: root/pdeath.c
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--pdeath.c (renamed from src/pdeath.c)16
1 files changed, 6 insertions, 10 deletions
diff --git a/src/pdeath.c b/pdeath.c
index 2d564a8..2cdbee2 100644
--- a/src/pdeath.c
+++ b/pdeath.c
@@ -1,5 +1,4 @@
/* See LICENSE file for copyright and license details. */
-
#include <sys/prctl.h>
#include <errno.h>
#include <limits.h>
@@ -10,8 +9,6 @@
#include <strings.h>
#include <unistd.h>
-#define FAILURE 127
-
struct sig {
int signo;
const char *name;
@@ -59,16 +56,15 @@ const char *argv0;
static void
usage(void)
{
- fprintf(stderr, "usage: %s (signal)[(+|-)off] command [arguments]...\n", argv0);
- fprintf(stderr, "usage: %s -L\n", argv0);
- exit(FAILURE);
+ fprintf(stderr, "usage: %s (-L | (signal)[(+|-)off] command [argument] ...)\n", argv0);
+ exit(127);
}
static void
invalid_signal(void)
{
fprintf(stderr, "%s: invalid signal\n", argv0);
- exit(FAILURE);
+ exit(127);
}
static void
@@ -138,7 +134,7 @@ main(int argc, char *argv[])
print_signals();
if (fflush(stdout) || fclose(stdout)) {
perror(argv0);
- return FAILURE;
+ return 127;
}
return 0;
}
@@ -161,10 +157,10 @@ main(int argc, char *argv[])
if (prctl(PR_SET_PDEATHSIG, signo) == -1) {
perror(argv0);
- return FAILURE;
+ return 127;
}
execvp(*argv, argv);
fprintf(stderr, "%s: %s: %s\n", argv0, strerror(errno), *argv);
- return FAILURE;
+ return 127;
}