summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog3
-rw-r--r--Src/jobs.c5
-rw-r--r--Test/B11kill.ztst10
3 files changed, 15 insertions, 3 deletions
diff --git a/ChangeLog b/ChangeLog
index 162bde6b0..9a7ca36a0 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,8 @@
2020-02-18 Chris Down <chris@chrisdown.name>
+ * 45453: Src/jobs.c, Test/B11kill.ztst: builtins: kill: Do not
+ signal current process group when pid is empty
+
* 45452: Test/B11kill.ztst: builtins: kill: Add `kill ''`
regression test with explicit sigspec
diff --git a/Src/jobs.c b/Src/jobs.c
index e7438251e..0485f2c7c 100644
--- a/Src/jobs.c
+++ b/Src/jobs.c
@@ -1854,13 +1854,14 @@ scanjobs(void)
/* This simple function indicates whether or not s may represent *
* a number. It returns true iff s consists purely of digits and *
- * minuses. Note that minus may appear more than once, and the empty *
- * string will produce a `true' response. */
+ * minuses. Note that minus may appear more than once. */
/**/
static int
isanum(char *s)
{
+ if (*s == '\0')
+ return 0;
while (*s == '-' || idigit(*s))
s++;
return *s == '\0';
diff --git a/Test/B11kill.ztst b/Test/B11kill.ztst
index 957a7b385..40dd99cd3 100644
--- a/Test/B11kill.ztst
+++ b/Test/B11kill.ztst
@@ -65,5 +65,13 @@
trap 'exit 11' URG
kill -URG ''
)
-1f:kill with empty pid and sigspec should not send signal to current process group
+1:kill with empty pid and sigspec should not send signal to current process group
?(eval):kill:3: illegal pid:
+
+ (
+ trap 'exit 19' TERM
+ kill ''
+ )
+1:Plain kill with empty pid should not send signal to current process group
+?(eval):kill:3: illegal pid:
+