/mandos/release

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

« back to all changes in this revision

Viewing changes to plugin-runner.c

merge

Show diffs side-by-side

added added

removed removed

Lines of Context:
38
38
#include <sys/select.h>         /* fd_set, select(), FD_ZERO(),
39
39
                                   FD_SET(), FD_ISSET(), FD_CLR */
40
40
#include <sys/wait.h>           /* wait(), waitpid(), WIFEXITED(),
41
 
                                   WEXITSTATUS() */
 
41
                                   WEXITSTATUS(), WTERMSIG(),
 
42
                                   WCOREDUMP() */
42
43
#include <sys/stat.h>           /* struct stat, stat(), S_ISREG() */
43
44
#include <iso646.h>             /* and, or, not */
44
45
#include <dirent.h>             /* DIR, struct dirent, opendir(),
52
53
                                   close() */
53
54
#include <fcntl.h>              /* fcntl(), F_GETFD, F_SETFD,
54
55
                                   FD_CLOEXEC */
55
 
#include <string.h>             /* strsep, strlen(), asprintf() */
 
56
#include <string.h>             /* strsep, strlen(), asprintf(),
 
57
                                   strsignal() */
56
58
#include <errno.h>              /* errno */
57
59
#include <argp.h>               /* struct argp_option, struct
58
60
                                   argp_state, struct argp,
457
459
      plugindir = strdup(arg);
458
460
      if(plugindir == NULL){
459
461
        perror("strdup");
460
 
      }      
 
462
      }
461
463
      break;
462
464
    case 129:                   /* --config-file */
463
465
      /* This is already done by parse_opt_config_file() */
527
529
      if(argfile == NULL){
528
530
        perror("strdup");
529
531
      }
530
 
      break;      
 
532
      break;
531
533
    case 130:                   /* --userid */
532
534
    case 131:                   /* --groupid */
533
535
    case 132:                   /* --debug */
562
564
    conffp = fopen(AFILE, "r");
563
565
  } else {
564
566
    conffp = fopen(argfile, "r");
565
 
  }  
 
567
  }
566
568
  if(conffp != NULL){
567
569
    char *org_line = NULL;
568
570
    char *p, *arg, *new_arg, *line;
612
614
          goto fallback;
613
615
        }
614
616
        custom_argv[custom_argc-1] = new_arg;
615
 
        custom_argv[custom_argc] = NULL;        
 
617
        custom_argv[custom_argc] = NULL;
616
618
      }
617
619
    }
618
620
    free(org_line);
973
975
                      WEXITSTATUS(proc->status));
974
976
            } else if(WIFSIGNALED(proc->status)){
975
977
              fprintf(stderr, "Plugin %s [%" PRIdMAX "] killed by"
976
 
                      " signal %d\n", proc->name,
 
978
                      " signal %d: %s\n", proc->name,
977
979
                      (intmax_t) (proc->pid),
978
 
                      WTERMSIG(proc->status));
 
980
                      WTERMSIG(proc->status),
 
981
                      strsignal(WTERMSIG(proc->status)));
979
982
            } else if(WCOREDUMP(proc->status)){
980
983
              fprintf(stderr, "Plugin %s [%" PRIdMAX "] dumped"
981
984
                      " core\n", proc->name, (intmax_t) (proc->pid));