Bash is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free
-Software Foundation; either version 1, or (at your option) any later
+Software Foundation; either version 2, or (at your option) any later
version.
Bash is distributed in the hope that it will be useful, but WITHOUT ANY
You should have received a copy of the GNU General Public License along
with Bash; see the file COPYING. If not, write to the Free Software
-Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA.
$PRODUCES kill.c
#endif /* !errno */
#if defined (JOB_CONTROL)
-extern int interactive;
-extern int job_control;
extern int posixly_correct;
#if !defined (CONTINUE_AFTER_KILL_ERROR)
int signal, any_succeeded, listing, saw_signal;
char *sigspec, *word;
pid_t pid;
+ long pid_value;
if (list == 0)
{
if (*word == '-')
word++;
- if (*word && all_digits (word))
+ if (*word && legal_number (word, &pid_value) && (pid_value == (pid_t)pid_value))
{
/* Use the entire argument in case of minus sign presence. */
- pid = (pid_t) atoi (list->word->word);
+ pid = (pid_t) pid_value;
if (kill_pid (pid, signal, 0) < 0)
goto signal_error;
if (kill_pid (pid, signal, 1) < 0)
{
signal_error:
- if (errno == EPERM)
- builtin_error ("(%d) - Not owner", (int)pid);
- else if (errno == ESRCH)
- builtin_error ("(%d) - No such pid", (int)pid);
- else
+ if (errno == EINVAL)
builtin_error ("Invalid signal %d", signal);
+ else
+ builtin_error ("(%ld) - %s", (long)pid, strerror (errno));
CONTINUE_OR_FAIL;
}
else