/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

Fixes for sscanf usage:

* plugin-runner.c (main): Parse numbers correctly and portably using
                          an intermediate "intmax_t".  Cast "pid_t" to
                          "intmax_t" before passing it to "printf()".
* plugins.d/mandos-client.c (main): Parse numbers correctly and
                                    portably using an intermediate
                                    "intmax_t".  Bug fix: cast
                                    "AvahiIfIndex" to "intmax_t" and
                                    use "PRIdMAX" instead of using
                                    "PRIu16", and use "PRIu16" to
                                    format port number.
* plugins.d/splashy.c (main): Parse numbers correctly and portably
                              using an intermediate "intmax_t".
* plugins.d/usplash.c (main): - '' -

Show diffs side-by-side

added added

removed removed

Lines of Context:
115
115
  if(name != NULL){
116
116
    copy_name = strdup(name);
117
117
    if(copy_name == NULL){
118
 
      free(new_plugin);
119
118
      return NULL;
120
119
    }
121
120
  }
122
121
  
123
 
  *new_plugin = (plugin){ .name = copy_name,
124
 
                          .argc = 1,
125
 
                          .disabled = false,
126
 
                          .next = plugin_list };
 
122
  *new_plugin = (plugin) { .name = copy_name,
 
123
                           .argc = 1,
 
124
                           .disabled = false,
 
125
                           .next = plugin_list };
127
126
  
128
127
  new_plugin->argv = malloc(sizeof(char *) * 2);
129
128
  if(new_plugin->argv == NULL){
376
375
  };
377
376
  
378
377
  error_t parse_opt(int key, char *arg, __attribute__((unused))
379
 
                    struct argp_state *state){
380
 
    switch(key){
 
378
                    struct argp_state *state) {
 
379
    switch(key) {
381
380
    case 'g':                   /* --global-options */
382
381
      if(arg != NULL){
383
382
        char *p;
512
511
     ignores everything but the --config-file option. */
513
512
  error_t parse_opt_config_file(int key, char *arg,
514
513
                                __attribute__((unused))
515
 
                                struct argp_state *state){
516
 
    switch(key){
 
514
                                struct argp_state *state) {
 
515
    switch(key) {
517
516
    case 'g':                   /* --global-options */
518
517
    case 'G':                   /* --global-env */
519
518
    case 'o':                   /* --options-for */
970
969
              fprintf(stderr, "Plugin %" PRIdMAX " exited with status"
971
970
                      " %d\n", (intmax_t) (proc->pid),
972
971
                      WEXITSTATUS(proc->status));
973
 
            } else if(WIFSIGNALED(proc->status)){
 
972
            } else if(WIFSIGNALED(proc->status)) {
974
973
              fprintf(stderr, "Plugin %" PRIdMAX " killed by signal"
975
974
                      " %d\n", (intmax_t) (proc->pid),
976
975
                      WTERMSIG(proc->status));