Fix -v, --verbose options to userspace programs.
authorBen Pfaff <blp@nicira.com>
Fri, 27 Jun 2008 21:16:53 +0000 (14:16 -0700)
committerBen Pfaff <blp@nicira.com>
Tue, 1 Jul 2008 17:51:47 +0000 (10:51 -0700)
Now providing an argument to these options works as documented.

lib/vlog.c

index 6316272..17f20a2 100644 (file)
@@ -232,12 +232,16 @@ vlog_set_levels_from_string(const char *s_)
 }
 
 /* If 'arg' is null, configure maximum verbosity.  Otherwise, sets
- * configuration according to 'arg' (see vlog_set_levels_from_string()).  If
- * parsing fails, default to maximum verbosity. */
+ * configuration according to 'arg' (see vlog_set_levels_from_string()). */
 void
 vlog_set_verbosity(const char *arg)
 {
-    if (arg == NULL || !vlog_set_levels_from_string(arg)) {
+    if (arg) {
+        char *msg = vlog_set_levels_from_string(arg);
+        if (msg) {
+            fatal(0, "processing \"%s\": %s", arg, msg);
+        }
+    } else {
         vlog_set_levels(VLM_ANY_MODULE, VLF_CONSOLE, VLL_DBG);
     }
 }