[or-cvs] pay attention to the return value of do_hup, and exit

Roger Dingledine arma at seul.org
Sat Oct 23 17:06:27 UTC 2004


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:
pay attention to the return value of do_hup, and exit
when it fails


Index: main.c
===================================================================
RCS file: /home/or/cvsroot/src/or/main.c,v
retrieving revision 1.337
retrieving revision 1.338
diff -u -d -r1.337 -r1.338
--- main.c	20 Oct 2004 23:15:49 -0000	1.337
+++ main.c	23 Oct 2004 17:06:25 -0000	1.338
@@ -737,14 +737,12 @@
   /* first, reload config variables, in case they've changed */
   /* no need to provide argc/v, they've been cached inside init_from_config */
   if (init_from_config(0, NULL) < 0) {
-    tor_cleanup();
-    exit(1);
+    return -1;
   }
   /* reload keys as needed for rendezvous services. */
   if (rend_service_load_keys()<0) {
     log_fn(LOG_ERR,"Error reloading rendezvous service keys");
-    tor_cleanup();
-    exit(1);
+    return -1;
   }
   if(retry_all_listeners() < 0) {
     log_fn(LOG_ERR,"Failed to bind one of the listener ports.");
@@ -848,7 +846,11 @@
       please_dumpstats = 0;
     }
     if(please_reset) {
-      do_hup();
+      if (do_hup() < 0) {
+        log_fn(LOG_WARN,"Restart failed (config error?). Exiting.");
+        tor_cleanup();
+        exit(1);
+      }
       please_reset = 0;
     }
     if(please_reap_children) {



More information about the tor-commits mailing list