Changeset 5268

Show
Ignore:
Timestamp:
02/14/08 06:16:33 (10 months ago)
Author:
morris
Message:

Update for libwired

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trackerd/trunk/trackerd/main.c

    r5146 r5268  
    5959 
    6060 
    61 static wi_boolean_t                             wt_daemonize = true; 
    62  
    6361wi_boolean_t                                    wt_running = true; 
    6462 
     
    9694         
    9795        /* set defaults */ 
    98         wi_root_path                   = wi_string_init_with_cstring(wi_string_alloc(), WT_ROOT); 
     96        wi_set_root_path(WI_STR(WT_ROOT)); 
    9997        wi_settings_config_path = wi_string_init_with_cstring(wi_string_alloc(), WT_CONFIG_PATH); 
    10098        no_chroot                               = false; 
     
    117115 
    118116                        case 'D': 
    119                                 wt_daemonize = false; 
     117                                daemonize = false; 
    120118                                wi_log_stderr = true; 
    121119                                break; 
    122120 
    123121                        case 'd': 
    124                                 wi_release(wi_root_path); 
    125                                 wi_root_path = wi_string_init_with_cstring(wi_string_alloc(), optarg); 
     122                                wi_set_root_path(wi_string_with_cstring(optarg)); 
    126123                                break; 
    127124 
     
    191188        /* detach */ 
    192189        if(daemonize) { 
     190                wi_log_info(WI_STR("forking")); 
    193191                wi_array_add_data(arguments, WI_STR("-X")); 
    194192                wi_array_insert_data_at_index(arguments, wi_string_with_cstring(argv[0]), 0); 
     
    222220        wt_servers_init(); 
    223221 
     222        /* change root directory */ 
     223        if(!no_chroot) { 
     224                if(!wi_chroot_to_root_path()) 
     225                        wi_log_err(WI_STR("Could not change root directory: %m")); 
     226        } 
     227 
    224228        /* read the config file */ 
    225         wt_settings_chroot = !no_chroot; 
    226229        wt_settings_init(); 
    227230 
    228231        if(!wt_settings_read_config()) 
    229232                exit(1); 
    230  
    231         /* change root directory */ 
    232         if(!no_chroot) { 
    233                 if(!wi_change_root()) 
    234                         wi_log_err(WI_STR("Could not change root to %@: %m"), wi_root_path); 
    235         } 
    236233 
    237234        /* apply settings */ 
  • trackerd/trunk/trackerd/settings.c

    r5078 r5268  
    3737 
    3838wt_settings_t                                   wt_settings; 
    39 wi_boolean_t                                    wt_settings_chroot; 
    4039 
    4140static wi_settings_t                    *wt_wi_settings; 
     
    7574 
    7675wi_boolean_t wt_settings_read_config(void) { 
    77         return wi_settings_read_file(wt_wi_settings, wt_settings_chroot); 
     76        return wi_settings_read_file(wt_wi_settings); 
    7877} 
    7978