Imported from ../bash-2.05a.tar.gz.
[platform/upstream/bash.git] / builtins / jobs.def
index 3b573b5..f8a2b00 100644 (file)
@@ -57,8 +57,7 @@ $END
 #define JSTATE_RUNNING 0x1
 #define JSTATE_STOPPED 0x2
 
-extern int job_control, interactive_shell;
-static int execute_list_with_replacements ();
+static int execute_list_with_replacements __P((WORD_LIST *));
 
 /* The `jobs' command.  Prints outs a list of active jobs.  If the
    argument `-l' is given, then the process id's are printed also.
@@ -220,6 +219,7 @@ disown_builtin (list)
 {
   int opt, job, retval, nohup_only, running_jobs, all_jobs;
   sigset_t set, oset;
+  long pid_value;
 
   nohup_only = running_jobs = all_jobs = 0;
   reset_internal_getopt ();
@@ -257,8 +257,8 @@ disown_builtin (list)
   do
     {
       BLOCK_CHILD (set, oset);
-      job = (list && all_digits(list->word->word))
-               ? get_job_by_pid (atoi(list->word->word), 0)
+      job = (list && legal_number (list->word->word, &pid_value) && pid_value == (pid_t) pid_value)
+               ? get_job_by_pid ((pid_t) pid_value, 0)
                : get_job_spec (list);
 
       if (job == NO_JOB || jobs == 0 || job < 0 || job >= job_slots || jobs[job] == 0)