Changeset d2d82a9a53340a06eb8bf7c7a9d67dddc345ffef

Show
Ignore:
Timestamp:
01/21/10 21:22:18 (8 years ago)
Author:
Theo Schlossnagle <jesus@omniti.com>
git-committer:
Theo Schlossnagle <jesus@omniti.com> 1264108938 +0000
git-parent:

[58fc542e232a765112f5752a98676f3e5fb39eb0]

git-author:
Theo Schlossnagle <jesus@omniti.com> 1264108938 +0000
Message:

fixes #239

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • src/noit_module.c

    r7afb4e3 rd2d82a9  
    7070static noit_hash_table modules = NOIT_HASH_EMPTY; 
    7171static noit_hash_table generics = NOIT_HASH_EMPTY; 
    72  
     72static int noit_module_load_failure_count = 0; 
     73 
     74int noit_module_load_failures() { 
     75  return noit_module_load_failure_count; 
     76
    7377noit_module_loader_t * noit_loader_lookup(const char *name) { 
    7478  void *vloader; 
     
    193197                     sizeof(noit_module_generic_t))) { 
    194198    noitL(noit_stderr, "Could not load %s:%s\n", g_file, g_name); 
     199    noit_module_load_failure_count++; 
    195200    return NULL; 
    196201  } 
     
    213218                     sizeof(noit_module_loader_t))) { 
    214219    noitL(noit_stderr, "Could not load %s:%s\n", loader_file, loader_name); 
     220    noit_module_load_failure_count++; 
    215221    return NULL; 
    216222  } 
     
    232238                     noit_module_validate_magic, sizeof(noit_module_t))) { 
    233239    noitL(noit_stderr, "Could not load %s:%s\n", module_file, module_name); 
     240    noit_module_load_failure_count++; 
    234241    return NULL; 
    235242  } 
  • src/noit_module.h

    re6b4cf6 rd2d82a9  
    102102  noit_module_init(); 
    103103API_EXPORT(int) 
     104  noit_module_load_failures(); 
     105API_EXPORT(int) 
    104106  noit_module_load(const char *file, const char *name); 
    105107API_EXPORT(noit_module_t *) 
  • src/noitd.c

    r48647bb rd2d82a9  
    7070static int foreground = 0; 
    7171static int debug = 0; 
     72static int strict_module_load = 0; 
    7273static char **enable_logs; 
    7374static int enable_logs_cnt = 0; 
     
    112113  enable_logs = calloc(argc, sizeof(*enable_logs)); 
    113114  disable_logs = calloc(argc, sizeof(*disable_logs)); 
    114   while((c = getopt(argc, argv, "hc:dDu:g:t:l:L:")) != EOF) { 
     115  while((c = getopt(argc, argv, "Mhc:dDu:g:t:l:L:")) != EOF) { 
    115116    switch(c) { 
     117      case 'M': 
     118        strict_module_load = 1; 
     119        break; 
    116120      case 'h': 
    117121        usage(argv[0]); 
     
    226230 
    227231  noit_module_init(); 
     232  if(strict_module_load && noit_module_load_failures() > 0) { 
     233    noitL(noit_stderr, "Failed to load some modules and -M given.\n"); 
     234    exit(2); 
     235  } 
    228236 
    229237  /* Drop privileges */ 
  • src/stratcond.c

    rf8b58d6 rd2d82a9  
    6464static int foreground = 0; 
    6565static int debug = 0; 
     66static int strict_module_load = 0; 
    6667static int no_store = 0; 
    6768static char **enable_logs; 
     
    107108  enable_logs = calloc(argc, sizeof(*enable_logs)); 
    108109  disable_logs = calloc(argc, sizeof(*disable_logs)); 
    109   while((c = getopt(argc, argv, "shc:dDu:g:t:l:L:")) != EOF) { 
     110  while((c = getopt(argc, argv, "Mshc:dDu:g:t:l:L:")) != EOF) { 
    110111    switch(c) { 
     112      case 'M': 
     113        strict_module_load = 1; 
     114        break; 
    111115      case 'l': 
    112116        enable_logs[enable_logs_cnt++] = strdup(optarg); 
     
    220224  noit_watchdog_child_eventer_heartbeat(); 
    221225 
    222   stratcon_datastore_init(); 
    223226  noit_console_init(APPNAME); 
    224227  noit_console_conf_init(); 
     
    229232 
    230233  noit_module_init(); 
     234  if(strict_module_load && noit_module_load_failures() > 0) { 
     235    noitL(noit_stderr, "Failed to load some modules and -M given.\n"); 
     236    exit(2); 
     237  } 
     238 
     239  stratcon_datastore_init(); 
    231240 
    232241  /* Drop privileges */