[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[or-cvs] put switch_id and start_daemon earlier
Update of /home/or/cvsroot/src/or
In directory moria.mit.edu:/home2/arma/work/onion/cvs/src/or
Modified Files:
main.c
Log Message:
put switch_id and start_daemon earlier
Index: main.c
===================================================================
RCS file: /home/or/cvsroot/src/or/main.c,v
retrieving revision 1.182
retrieving revision 1.183
diff -u -d -r1.182 -r1.183
--- main.c 29 Feb 2004 03:52:38 -0000 1.182
+++ main.c 29 Feb 2004 22:34:38 -0000 1.183
@@ -430,6 +430,17 @@
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 @@
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 @@
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 */
}