[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[or-cvs] try to address bug 257: if rename() fails during saveconf, ...



Update of /home2/or/cvsroot/tor/src/or
In directory moria:/home/arma/work/onion/cvs/tor/src/or

Modified Files:
	config.c 
Log Message:
try to address bug 257: if rename() fails during saveconf, tell
the controller.


Index: config.c
===================================================================
RCS file: /home2/or/cvsroot/tor/src/or/config.c,v
retrieving revision 1.518
retrieving revision 1.519
diff -u -p -d -r1.518 -r1.519
--- config.c	19 Feb 2006 22:02:01 -0000	1.518
+++ config.c	19 Feb 2006 23:12:26 -0000	1.519
@@ -3653,7 +3653,12 @@ write_configuration_file(const char *fna
       ++i;
     }
     log_notice(LD_CONFIG, "Renaming old configuration file to \"%s\"", fn_tmp);
-    rename(fname, fn_tmp);
+    if (rename(fname, fn_tmp) < 0) {
+      log_warn(LD_FS, "Couldn't rename \"%s\" to \"%s\": %s",
+             fname, fn_tmp, strerror(errno));
+      tor_free(fn_tmp);
+      goto err;
+    }
     tor_free(fn_tmp);
   }