diff options
author | Roger Dingledine <arma@torproject.org> | 2004-02-29 22:34:38 +0000 |
---|---|---|
committer | Roger Dingledine <arma@torproject.org> | 2004-02-29 22:34:38 +0000 |
commit | 2c341cd0328122ee59856a381ca7d2b2fad77506 (patch) | |
tree | aa2924445e619b60240cbc78c583ef8d9d7b84ef /src | |
parent | e2881631cf9ddcd2d13e04b237f047d8032c9513 (diff) | |
download | tor-2c341cd0328122ee59856a381ca7d2b2fad77506.tar.gz tor-2c341cd0328122ee59856a381ca7d2b2fad77506.zip |
put switch_id and start_daemon earlier
svn:r1188
Diffstat (limited to 'src')
-rw-r--r-- | src/or/main.c | 21 |
1 files changed, 11 insertions, 10 deletions
diff --git a/src/or/main.c b/src/or/main.c index b80ac9cd7e..3328ed2bbd 100644 --- a/src/or/main.c +++ b/src/or/main.c @@ -430,6 +430,17 @@ static int init_from_config(int argc, char **argv) { return -1; } close_logs(); /* we'll close, then open with correct loglevel if necessary */ + + if(options.User || options.Group) { + if(switch_id(options.User, options.Group) != 0) { + return -1; + } + } + + if (options.RunAsDaemon) { + start_daemon(options.DataDirectory); + } + if(!options.LogFile && !options.RunAsDaemon) add_stream_log(options.loglevel, "<stdout>", stdout); if(options.LogFile) { @@ -450,12 +461,6 @@ static int init_from_config(int argc, char **argv) { global_read_bucket = options.BandwidthBurst; /* start it at max traffic */ stats_prev_global_read_bucket = global_read_bucket; - if(options.User || options.Group) { - if(switch_id(options.User, options.Group) != 0) { - return -1; - } - } - if(options.RunAsDaemon) { /* XXXX Can we delay this any more? */ finish_daemon(); @@ -680,10 +685,6 @@ int tor_main(int argc, char *argv[]) { log_fn(LOG_WARN,"You are running Tor as root. You don't need to, and you probably shouldn't."); #endif - if (options.RunAsDaemon) { - start_daemon(options.DataDirectory); - } - if(options.ORPort) { /* only spawn dns handlers if we're a router */ dns_init(); /* initialize the dns resolve tree, and spawn workers */ } |