Changeset 3438 for trunk/src/kash/bltin/kill.c
- Timestamp:
- Sep 9, 2020, 10:01:39 PM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/kash/bltin/kill.c
r3409 r3438 61 61 killcmd(shinstance *psh, int argc, char *argv[]) 62 62 { 63 int errors, numsig , pid;63 int errors, numsig; 64 64 char *ep; 65 65 … … 131 131 132 132 for (errors = 0; argc; argc--, argv++) { 133 if (*argv[0] == '%') { 134 pid = getjobpgrp(psh, *argv); 133 const char * const strpid = argv[0]; 134 shpid pid; 135 if (*strpid == '%') { 136 pid = getjobpgrp(psh, strpid); 135 137 if (pid == 0) { 136 sh_warnx(psh, "illegal job id: %s", *argv);138 sh_warnx(psh, "illegal job id: %s", strpid); 137 139 errors = 1; 138 140 continue; 139 141 } 140 142 } else { 141 pid = strtol(*argv, &ep, 10); 142 if (!**argv || *ep) { 143 sh_warnx(psh, "illegal process id: %s", *argv); 143 #if !defined(SH_FORKED_MODE) && defined(_MSC_VER) 144 pid = _strtoi64(strpid, &ep, 10); 145 #elif !defined(SH_FORKED_MODE) 146 pid = strtoll(strpid, &ep, 10); 147 #else 148 pid = strtol(strpid, &ep, 10); 149 #endif 150 if (!*strpid || *ep) { 151 sh_warnx(psh, "illegal process id: %s", strpid); 144 152 errors = 1; 145 153 continue; … … 147 155 } 148 156 if (sh_kill(psh, pid, numsig) == -1) { 149 sh_warn(psh, "%s", *argv);157 sh_warn(psh, "%s", strpid); 150 158 errors = 1; 151 159 }
Note:
See TracChangeset
for help on using the changeset viewer.