]> git.ipfire.org Git - thirdparty/tor.git/commitdiff
Clean up a bit of C logic, and fix an erroneous warning.
authorNick Mathewson <nickm@torproject.org>
Sat, 30 May 2009 03:28:01 +0000 (23:28 -0400)
committerNick Mathewson <nickm@torproject.org>
Sat, 30 May 2009 03:28:01 +0000 (23:28 -0400)
(Simplify "if (cond) return 1; return 0;" to "return cond;", and don't
give a warning when we start with accounting on but dirport off.)

src/or/config.c

index 5bf3fd41b554fa494fc3f5da6503bc7c6a215ce7..81999516ddb5ad25018eb9f0ec7dae92a3c0f0f6 100644 (file)
@@ -2634,12 +2634,11 @@ is_listening_on_low_port(uint16_t port_option,
 #else
   const config_line_t *l;
   uint16_t p;
-  if (listen_options == NULL) {
-    if (port_option < 1024) {
-      return 1;
-    }
-    return 0;
-  }
+  if (port_option == 0)
+    return 0; /* We're not listening */
+  if (listen_options == NULL)
+    return (port_option < 1024);
+
   for (l = listen_options; l; l = l->next) {
     parse_addr_port(LOG_WARN, l->value, NULL, NULL, &p);
     if (p<1024) {