IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Mar 1, 2016, 11:34:48 AM (10 years ago)
Author:
eugene
Message:

list unused parameters; replace old signal code with SetInterrupt, ClearInterrupt; fix unsigned / signed int inconsistencies

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/eam_branches/ohana.20160226/src/opihi/cmd.basic/shell.c

    r33662 r39419  
    5151  // wait for process to finish or timeout
    5252  // loop forever if desired, but catch C-C and stop the process on interrupt
    53   interrupt = FALSE;
     53  struct sigaction *old_sigaction = SetInterrupt();
    5454  while (!interrupt) {
    5555    result = waitpid (pid, &wait_status, WNOHANG);
     
    5959          case ECHILD:
    6060            gprint (GP_ERR, "unknown PID, not a child process: %d\n", pid);
     61            ClearInterrupt (old_sigaction);
    6162            return (FALSE);
    6263          default:
     
    7273          if (DTIME(now, start) > timeout) {
    7374            gprint (GP_ERR, "timeout on %s (pid %d)\n", argv[1], pid);
     75            ClearInterrupt (old_sigaction);
    7476            return (FALSE);
    7577          }
     
    8385        }
    8486        if (WIFEXITED(wait_status)) {
     87          ClearInterrupt (old_sigaction);
    8588          exit_status = WEXITSTATUS(wait_status);
    8689          if (exit_status) {
     
    9194        }
    9295        if (WIFSIGNALED(wait_status)) {
     96          ClearInterrupt (old_sigaction);
    9397          gprint (GP_ERR, "job %d exited on signal %d\n", pid, WTERMSIG(wait_status));
    9498          return (FALSE);
     
    100104    }
    101105  }
     106  ClearInterrupt (old_sigaction);
    102107  gprint (GP_ERR, "caught interrupt, killing %s (%d)\n", argv[1], pid);
    103108
Note: See TracChangeset for help on using the changeset viewer.