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

[or-cvs] Make sure that cached-status directory exists.



Update of /home/or/cvsroot/tor/src/or
In directory moria:/tmp/cvs-serv4827/src/or

Modified Files:
	config.c 
Log Message:
Make sure that cached-status directory exists.

Index: config.c
===================================================================
RCS file: /home/or/cvsroot/tor/src/or/config.c,v
retrieving revision 1.400
retrieving revision 1.401
diff -u -d -r1.400 -r1.401
--- config.c	26 Aug 2005 20:26:20 -0000	1.400
+++ config.c	26 Aug 2005 22:03:57 -0000	1.401
@@ -408,6 +408,8 @@
 options_act(or_options_t *old_options)
 {
   config_line_t *cl;
+  char *fn;
+  size_t len;
   or_options_t *options = get_options();
   static int libevent_initialized = 0;
 
@@ -446,6 +448,15 @@
            options->DataDirectory);
     return -1;
   }
+  len = strlen(options->DataDirectory)+32;
+  fn = tor_malloc(len);
+  tor_snprintf(fn, len, "%s/cached-status", options->DataDirectory);
+  if (check_private_dir(fn, CPD_CREATE) != 0) {
+    log_fn(LOG_ERR, "Couldn't access/create private data directory \"%s\"",fn);
+    tor_free(fn);
+    return -1;
+  }
+  tor_free(fn);
 
   /* Bail out at this point if we're not going to be a client or server:
    * we want to not fork, and to log stuff to stderr. */