]> arthur.barton.de Git - netatalk.git/commitdiff
start LOG earlier
authorHAT <hat@fa2.so-net.ne.jp>
Thu, 5 Apr 2012 14:08:02 +0000 (23:08 +0900)
committerHAT <hat@fa2.so-net.ne.jp>
Thu, 5 Apr 2012 14:08:02 +0000 (23:08 +0900)
bin/ad/ad.c
etc/afpd/main.c
etc/cnid_dbd/cmd_dbd.c
etc/cnid_dbd/cnid_metad.c
etc/cnid_dbd/main.c
etc/netatalk/netatalk.c
include/atalk/netatalk_conf.h
libatalk/util/netatalk_conf.c
test/afpd/test.c

index 6115c2f2fb3c21b73e07d70793785fe82aae4417..883378f58f68b2217feccb8c805f6df2883148b1 100644 (file)
@@ -55,7 +55,7 @@ int main(int argc, char **argv)
         return 1;
     }
 
-    if (afp_config_parse(&obj) != 0)
+    if (afp_config_parse(&obj, "") != 0)
         return 1;
 
     if (load_volumes(&obj, NULL) != 0)
index 9f45b5b23f68bd7e6d61934e83ae89b8263b9e6e..550a809f82a61ca7c8f85b3d001a16fc1d3e62cd 100644 (file)
@@ -225,12 +225,9 @@ int main(int ac, char **av)
     /* Log SIGBUS/SIGSEGV SBT */
     fault_setup(NULL);
 
-    if (afp_config_parse(&obj) != 0)
+    if (afp_config_parse(&obj, "afpd") != 0)
         afp_exit(EXITERR_CONF);
 
-    set_processname("afpd");
-    setuplog(obj.options.logconfig, obj.options.logfile);
-
     /* Save the user's current umask */
     obj.options.save_mask = umask(obj.options.umask);
 
index 7a1614f7ac4c4f549101e4d9ae85a01489c56a89..70f0014ebddc1d94eb1bd49fe83977ca098cf984 100644 (file)
@@ -258,7 +258,7 @@ int main(int argc, char **argv)
         setuplog("default:debug", "/dev/tty");
 
     /* Load config */
-    if (afp_config_parse(&obj) != 0) {
+    if (afp_config_parse(&obj, "") != 0) {
         dbd_log( LOGSTD, "Couldn't load afp.conf");
         exit(EXIT_FAILURE);
     }
index b140fd0945cd23661c686e56ab4d18eceb86d008..7cfd3da8a5a466baa2540bf6b02db54641793b1b 100644 (file)
@@ -499,12 +499,9 @@ int main(int argc, char *argv[])
     if (!debug && daemonize(0, 0) != 0)
         exit(EXITERR_SYS);
 
-    if (afp_config_parse(&obj) != 0)
+    if (afp_config_parse(&obj, "cnid_metad") != 0)
         daemon_exit(1);
 
-    set_processname("cnid_metad");
-    setuplog(obj.options.logconfig, obj.options.logfile);
-
     if (load_volumes(&obj, NULL) != 0)
         daemon_exit(1);
 
index a5fbb2a23985438ccc878a0044816cc46013c421..8ed0e5ff2bcd37796511c3094689ce3b7dfb6da8 100644 (file)
@@ -312,10 +312,7 @@ int main(int argc, char *argv[])
         exit(EXIT_FAILURE);
     }
 
-    EC_ZERO( afp_config_parse(&obj) );
-
-    set_processname("cnid_dbd");
-    setuplog(obj.options.logconfig, obj.options.logfile);
+    EC_ZERO( afp_config_parse(&obj, "cnid_dbd") );
 
     EC_ZERO( load_volumes(&obj, NULL) );
     EC_NULL( vol = getvolbypath(&obj, volpath) );
index 3d052f46d3897100895ec85c301a47d339125790..f2a94102470e85e8527701d618df39626359ea7e 100644 (file)
@@ -272,11 +272,9 @@ int main(int argc, char **argv)
     sigfillset(&blocksigs);
     sigprocmask(SIG_SETMASK, &blocksigs, NULL);
     
-    if (afp_config_parse(&obj) != 0)
+    if (afp_config_parse(&obj, "netatalk") != 0)
         netatalk_exit(EXITERR_CONF);
 
-    set_processname("netatalk");
-    setuplog(obj.options.logconfig, obj.options.logfile);
     event_set_log_callback(libevent_logmsg_cb);
     event_set_fatal_callback(netatalk_exit);
 
index 5715df748fed5f9c05198a0a8b4d3b59db61aeaa..4c9148576238b1c77ec47c3aee373ba57c848268 100644 (file)
@@ -20,7 +20,7 @@
 #include <atalk/globals.h>
 #include <atalk/volume.h>
 
-extern int        afp_config_parse(AFPObj *obj);
+extern int        afp_config_parse(AFPObj *obj, char *processname);
 
 extern int        load_charset(struct vol *vol);
 extern int        load_volumes(AFPObj *obj, void (*delvol_fn)(struct vol *));
index a75ded21b552486f505da5e87bcc5fb5f624053a..98d1c806814a1193177e4bc5ad5140632d37deb1 100644 (file)
@@ -1380,7 +1380,7 @@ struct vol *getvolbyname(const char *name)
 /*!
  * Initialize an AFPObj and options from ini config file
  */
-int afp_config_parse(AFPObj *AFPObj)
+int afp_config_parse(AFPObj *AFPObj, char *processname)
 {
     EC_INIT;
     dictionary *config;
@@ -1404,6 +1404,11 @@ int afp_config_parse(AFPObj *AFPObj)
     options->logconfig = iniparser_getstrdup(config, INISEC_GLOBAL, "log level", "default:note");
     options->logfile   = iniparser_getstrdup(config, INISEC_GLOBAL, "log file",  NULL);
 
+    if (processname[0] != '\0') {
+        set_processname(processname);
+        setuplog(options->logconfig, options->logfile);
+    }
+
     /* "server options" boolean options */
     if (!iniparser_getboolean(config, INISEC_GLOBAL, "zeroconf", 1))
         options->flags |= OPTION_NOZEROCONF;
index 1a8830029b3c2b838b42ce2a927b1e92d6151ce7..acc46a8765b37227ec630e0efa35c49841970314 100644 (file)
@@ -64,7 +64,7 @@ int main(int argc, char **argv)
 
     TEST( afp_options_parse_cmdline(&obj, 3, &args[0]) );
 
-    TEST_int( afp_config_parse(&obj), 0);
+    TEST_int( afp_config_parse(&obj, ""), 0);
     TEST_int( configinit(&obj), 0);
     TEST( cnid_init() );
     TEST( load_volumes(&obj, NULL) );