/mandos/trunk

To get this branch, use:
bzr branch http://bzr.recompile.se/loggerhead/mandos/trunk

« back to all changes in this revision

Viewing changes to plugin-runner.c

  • Committer: Teddy Hogeborn
  • Date: 2009-02-05 03:26:27 UTC
  • Revision ID: teddy@fukt.bsnet.se-20090205032627-fbvgm97q5gtrbg10
* plugin-runner.c (handle_sigchld): Bug fix: Save and restore "errno".

Show diffs side-by-side

added added

removed removed

Lines of Context:
664
664
  }
665
665
  
666
666
  /* Strip permissions down to nobody */
 
667
  ret = setuid(uid);
 
668
  if(ret == -1){
 
669
    perror("setuid");
 
670
  }  
667
671
  setgid(gid);
668
672
  if(ret == -1){
669
673
    perror("setgid");
670
674
  }
671
 
  ret = setuid(uid);
672
 
  if(ret == -1){
673
 
    perror("setuid");
674
 
  }
675
675
  
676
676
  if(plugindir == NULL){
677
677
    dir = opendir(PDIR);
969
969
 
970
970
          if(debug){
971
971
            if(WIFEXITED(proc->status)){
972
 
              fprintf(stderr, "Plugin %s [%" PRIdMAX "] exited with"
973
 
                      " status %d\n", proc->name,
974
 
                      (intmax_t) (proc->pid),
 
972
              fprintf(stderr, "Plugin %" PRIdMAX " exited with status"
 
973
                      " %d\n", (intmax_t) (proc->pid),
975
974
                      WEXITSTATUS(proc->status));
976
975
            } else if(WIFSIGNALED(proc->status)){
977
 
              fprintf(stderr, "Plugin %s [%" PRIdMAX "] killed by"
978
 
                      " signal %d\n", proc->name,
979
 
                      (intmax_t) (proc->pid),
 
976
              fprintf(stderr, "Plugin %" PRIdMAX " killed by signal"
 
977
                      " %d\n", (intmax_t) (proc->pid),
980
978
                      WTERMSIG(proc->status));
981
979
            } else if(WCOREDUMP(proc->status)){
982
 
              fprintf(stderr, "Plugin %s [%" PRIdMAX "] dumped"
983
 
                      " core\n", proc->name, (intmax_t) (proc->pid));
 
980
              fprintf(stderr, "Plugin %" PRIdMAX " dumped core\n",
 
981
                      (intmax_t) (proc->pid));
984
982
            }
985
983
          }
986
984