summaryrefslogtreecommitdiffstats
path: root/contrib/tcsh/sh.proc.c
diff options
context:
space:
mode:
authormp <mp@FreeBSD.org>2004-07-11 02:17:56 +0000
committermp <mp@FreeBSD.org>2004-07-11 02:17:56 +0000
commitbbd1addf8f9452690ad13ce5b875ee4cc9633958 (patch)
tree730792f0cc19f3bb4fb663fe727589381f5901be /contrib/tcsh/sh.proc.c
parentf2c2aa29b7d05c53575ab7ce4dc5870fd33a1310 (diff)
downloadFreeBSD-src-bbd1addf8f9452690ad13ce5b875ee4cc9633958.zip
FreeBSD-src-bbd1addf8f9452690ad13ce5b875ee4cc9633958.tar.gz
Import of tcsh-6.13.00
Diffstat (limited to 'contrib/tcsh/sh.proc.c')
-rw-r--r--contrib/tcsh/sh.proc.c20
1 files changed, 12 insertions, 8 deletions
diff --git a/contrib/tcsh/sh.proc.c b/contrib/tcsh/sh.proc.c
index 7d42f5c..b91a6dc 100644
--- a/contrib/tcsh/sh.proc.c
+++ b/contrib/tcsh/sh.proc.c
@@ -1,4 +1,4 @@
-/* $Header: /src/pub/tcsh/sh.proc.c,v 3.76 2002/03/08 17:36:46 christos Exp $ */
+/* $Header: /src/pub/tcsh/sh.proc.c,v 3.81 2003/11/09 03:02:46 christos Exp $ */
/*
* sh.proc.c: Job manipulations
*/
@@ -32,7 +32,7 @@
*/
#include "sh.h"
-RCSID("$Id: sh.proc.c,v 3.76 2002/03/08 17:36:46 christos Exp $")
+RCSID("$Id: sh.proc.c,v 3.81 2003/11/09 03:02:46 christos Exp $")
#include "ed.h"
#include "tc.h"
@@ -603,7 +603,7 @@ pjwait(pp)
if ((jobflags & PRUNNING) == 0)
break;
#ifdef JOBDEBUG
- xprintf("%d starting to sigpause for SIGCHLD on %d\n",
+ xprintf("%d starting to sigpause for SIGCHLD on %d\n",
getpid(), fp->p_procid);
#endif /* JOBDEBUG */
#ifdef BSDSIGS
@@ -1566,8 +1566,9 @@ dokill(v, c)
}
}
if (Isdigit(*sigptr)) {
- signum = atoi(short2str(sigptr));
- if (signum < 0 || signum > (MAXSIG-1))
+ char *ep;
+ signum = strtoul(short2str(sigptr), &ep, 0);
+ if (*ep || signum < 0 || signum > (MAXSIG-1))
stderror(ERR_NAME | ERR_BADSIG);
}
else {
@@ -1677,12 +1678,15 @@ pkill(v, signum)
else if (!(Isdigit(*cp) || *cp == '-'))
stderror(ERR_NAME | ERR_JOBARGS);
else {
+ char *ep;
#ifndef WINNT_NATIVE
- pid = atoi(short2str(cp));
+ pid = strtol(short2str(cp), &ep, 10);
#else
- pid = strtoul(short2str(cp),NULL,0);
+ pid = strtoul(short2str(cp), &ep, 0);
#endif /* WINNT_NATIVE */
- if (kill(pid, signum) < 0) {
+ if (*ep)
+ stderror(ERR_NAME | ERR_JOBARGS);
+ else if (kill(pid, signum) < 0) {
xprintf("%d: %s\n", pid, strerror(errno));
err1++;
goto cont;
OpenPOWER on IntegriCloud