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

[or-cvs] size_t)-1 is never < 0; fix an XXXX008 by changing the inte...



Update of /home/or/cvsroot/src/or
In directory moria.mit.edu:/tmp/cvs-serv17450/src/or

Modified Files:
	dirserv.c directory.c 
Log Message:
(size_t)-1 is never < 0; fix an XXXX008 by changing the interface for dirserv_get_runningrouters

Index: dirserv.c
===================================================================
RCS file: /home/or/cvsroot/src/or/dirserv.c,v
retrieving revision 1.71
retrieving revision 1.72
diff -u -d -r1.71 -r1.72
--- dirserv.c	6 Aug 2004 02:27:06 -0000	1.71
+++ dirserv.c	6 Aug 2004 20:00:14 -0000	1.72
@@ -741,14 +741,14 @@
 }
 
 /** Set *<b>rr</b> to the most recently generated encoded signed
- * running-routers list, generating a new one as necessary. */
+ * running-routers list, generating a new one as necessary.  Return the
+ * size of the directory on success, and 0 on failure. */
 size_t dirserv_get_runningrouters(const char **rr)
-/* XXX008 Bug: size_t is unsigned, but we're returning -1 to mean error */
 {
   if (runningrouters_is_dirty) {
     if(generate_runningrouters(get_identity_key())) {
       log_fn(LOG_ERR, "Couldn't generate running-routers list?");
-      return -1;
+      return 0;
     }
   }
   *rr = runningrouters_string;

Index: directory.c
===================================================================
RCS file: /home/or/cvsroot/src/or/directory.c,v
retrieving revision 1.121
retrieving revision 1.122
diff -u -d -r1.121 -r1.122
--- directory.c	4 Aug 2004 01:15:57 -0000	1.121
+++ directory.c	6 Aug 2004 20:00:16 -0000	1.122
@@ -533,7 +533,7 @@
       return 0;
     }
     dlen = dirserv_get_runningrouters(&cp);
-    if(dlen < 0) { /* we failed to create cp */
+    if(!dlen) { /* we failed to create cp */
       connection_write_to_buf(answer503, strlen(answer503), conn);
       return 0;
     }