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

[or-cvs] Refuse to use RunAsDaemon when torrc is a relative path. Fi...



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

Modified Files:
	util.c util.h 
Log Message:
Refuse to use RunAsDaemon when torrc is a relative path. Fixes bug 229.

Index: util.c
===================================================================
RCS file: /home/or/cvsroot/tor/src/common/util.c,v
retrieving revision 1.242
retrieving revision 1.243
diff -u -p -d -r1.242 -r1.243
--- util.c	1 Jan 2006 23:13:19 -0000	1.242
+++ util.c	10 Jan 2006 20:00:20 -0000	1.243
@@ -1314,6 +1314,17 @@ tor_listdir(const char *dirname)
   return result;
 }
 
+/** Return true iff <b>filename</b> is a relative path.  (XXXX doesn't work on
+ * windows.) */
+int
+path_is_relative(const char *filename)
+{
+  if (filename && filename[0] == '/')
+    return 0;
+  else
+    return 1;
+}
+
 /* =====
  * Net helpers
  * ===== */

Index: util.h
===================================================================
RCS file: /home/or/cvsroot/tor/src/common/util.h,v
retrieving revision 1.150
retrieving revision 1.151
diff -u -p -d -r1.150 -r1.151
--- util.h	9 Dec 2005 05:15:36 -0000	1.150
+++ util.h	10 Jan 2006 20:00:20 -0000	1.151
@@ -158,6 +158,7 @@ char *read_file_to_str(const char *filen
 char *parse_line_from_str(char *line, char **key_out, char **value_out);
 char *expand_filename(const char *filename);
 struct smartlist_t *tor_listdir(const char *dirname);
+int path_is_relative(const char *filename);
 
 /* Net helpers */
 int is_internal_IP(uint32_t ip, int for_listening);