Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristopher Faylor <me@cgf.cx>2003-09-21 00:27:10 +0400
committerChristopher Faylor <me@cgf.cx>2003-09-21 00:27:10 +0400
commit4114df05155afc462b21504f38f8c25d0bd585dd (patch)
treeb349efdeb5021ed2fef09bdb76a94df0531bca44
parent9d5b9cac9ad780bfd638337c8db0068da88334e6 (diff)
* kill.cc (main): Allow negative pids (indicates process groups).cr-0x9b
-rw-r--r--winsup/utils/ChangeLog4
-rw-r--r--winsup/utils/kill.cc17
2 files changed, 18 insertions, 3 deletions
diff --git a/winsup/utils/ChangeLog b/winsup/utils/ChangeLog
index 62399be9a..819c5b16b 100644
--- a/winsup/utils/ChangeLog
+++ b/winsup/utils/ChangeLog
@@ -1,3 +1,7 @@
+2003-09-20 Christopher Faylor <cgf@redhat.com>
+
+ * kill.cc (main): Allow negative pids (indicates process groups).
+
2003-09-17 Christopher Faylor <cgf@redhat.com>
* parse_pe.cc (exclusion::sort_and_check): Make error message a little
diff --git a/winsup/utils/kill.cc b/winsup/utils/kill.cc
index 8067cf825..a4dba050d 100644
--- a/winsup/utils/kill.cc
+++ b/winsup/utils/kill.cc
@@ -164,6 +164,10 @@ main (int argc, char **argv)
usage ();
opterr = 0;
+
+ char *p;
+ int pid = 0;
+
for (;;)
{
int ch;
@@ -201,7 +205,12 @@ main (int argc, char **argv)
break;
case '?':
if (gotasig)
- usage ();
+ {
+ pid = strtol (argv[optind], &p, 10);
+ if (pid < 0)
+ goto out;
+ usage ();
+ }
optreset = 1;
optind = 1 + av - argv;
gotasig = *av + 1;
@@ -213,13 +222,14 @@ main (int argc, char **argv)
}
}
+out:
test_for_unknown_sig (sig, gotasig);
argv += optind;
while (*argv != NULL)
{
- char *p;
- int pid = strtol (*argv, &p, 10);
+ if (!pid)
+ pid = strtol (*argv, &p, 10);
if (*p != '\0')
{
fprintf (stderr, "%s: illegal pid: %s\n", prog_name, *argv);
@@ -240,6 +250,7 @@ main (int argc, char **argv)
ret = 1;
}
argv++;
+ pid = 0;
}
return ret;
}