diff options
author | Christopher Faylor <me@cgf.cx> | 2001-10-08 07:06:25 +0400 |
---|---|---|
committer | Christopher Faylor <me@cgf.cx> | 2001-10-08 07:06:25 +0400 |
commit | 12f6d7bc9c03c6fdb97251350d8d3edce85f0396 (patch) | |
tree | 2b0f2d9d9fd394d3da5598006cd02a6d73662f18 /winsup/utils/kill.cc | |
parent | c27a29813a634f283a405df1165f0010bb10eb74 (diff) |
* kill.cc (main): Set exit value to 1 on invalid pid. Perform minor cleanup.
Diffstat (limited to 'winsup/utils/kill.cc')
-rw-r--r-- | winsup/utils/kill.cc | 37 |
1 files changed, 15 insertions, 22 deletions
diff --git a/winsup/utils/kill.cc b/winsup/utils/kill.cc index 8ca36bcda..626b07156 100644 --- a/winsup/utils/kill.cc +++ b/winsup/utils/kill.cc @@ -61,30 +61,23 @@ sig0: char *p; int pid = strtol (*argv, &p, 10); if (*p != '\0') - fprintf (stderr, "kill: illegal pid: %s\n", *argv); + { + fprintf (stderr, "kill: illegal pid: %s\n", *argv); + ret = 1; + } + else if (kill (pid, sig) == 0) + { + if (force) + forcekill (pid, sig, 1); + } + else if (force && sig != 0) + forcekill (pid, sig, 0); else { -#if 0 - printf ("Sending %s(%d) signal to pid %d\n", - strsignal (sig), sig, pid); -#endif - if (kill (pid, sig) == 0) - { - if (force) - forcekill (pid, sig, 1); - } - else - { - if (force && sig != 0) - forcekill (pid, sig, 0); - else - { - char buf[1000]; - sprintf (buf, "kill %d", pid); - perror (buf); - ret = 1; - } - } + char buf[1000]; + sprintf (buf, "kill %d", pid); + perror (buf); + ret = 1; } argv++; } |