/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

merge + small bugfix

Show diffs side-by-side

added added

removed removed

Lines of Context:
108
108
  char *copy_name = NULL;
109
109
  if(name != NULL){
110
110
    copy_name = strdup(name);
111
 
    if(copy_name == NULL){
112
 
      return NULL;
113
 
    }
 
111
  }
 
112
  if(copy_name == NULL){
 
113
    return NULL;
114
114
  }
115
115
  
116
116
  *new_plugin = (plugin) { .name = copy_name,
252
252
    return NULL;
253
253
  }
254
254
  argv[*argc-1] = arg;
255
 
  argv[*argc] = NULL;
 
255
  argv[*argc] = NULL;   
256
256
  return argv;
257
257
}
258
258
 
259
259
static void free_plugin_list(plugin *plugin_list){
260
 
  for(plugin *next; plugin_list != NULL; plugin_list = next){
 
260
  for(plugin *next = plugin_list; plugin_list != NULL; plugin_list = next){
261
261
    next = plugin_list->next;
 
262
    free(plugin_list->name);
262
263
    for(char **arg = plugin_list->argv; *arg != NULL; arg++){
263
264
      free(*arg);
264
 
    }
 
265
    }    
265
266
    free(plugin_list->argv);
266
267
    for(char **env = plugin_list->environ; *env != NULL; env++){
267
268
      free(*env);
268
269
    }
269
270
    free(plugin_list->environ);
270
271
    free(plugin_list);
271
 
  }
 
272
  }  
272
273
}
273
274
 
274
275
int main(int argc, char *argv[]){
302
303
  ret = sigaction(SIGCHLD, &sigchld_action, &old_sigchld_action);
303
304
  if(ret == -1){
304
305
    perror("sigaction");
305
 
    exitstatus = EXIT_FAILURE;
 
306
    exitstatus = EXIT_FAILURE;    
306
307
    goto fallback;
307
308
  }
308
309
  
684
685
      }
685
686
    }
686
687
    
687
 
    int pipefd[2];
 
688
    int pipefd[2]; 
688
689
    ret = pipe(pipefd);
689
690
    if (ret == -1){
690
691
      perror("pipe");
791
792
  }
792
793
  
793
794
  free_plugin_list(plugin_list);
794
 
  plugin_list = NULL;
795
795
  
796
796
  closedir(dir);
797
797
  dir = NULL;