bug-inetutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [bug-inetutils] [PATCH] Fix ifconfig unknown format bug


From: Alfred M. Szmidt
Subject: Re: [bug-inetutils] [PATCH] Fix ifconfig unknown format bug
Date: Sat, 10 Jul 2010 14:14:44 -0400

Thank you for your patch, I commited the following instead.  It will
error out earlier, and keep the parsing routines in one place.

2010-07-10  Alfred M. Szmidt  <address@hidden>

        * ifconfig/options.c (parse_opt_set_default_format): Abort if no
        output format could be found.

diff --git a/ifconfig/options.c b/ifconfig/options.c
index 3e3a196..752aa47 100644
--- a/ifconfig/options.c
+++ b/ifconfig/options.c
@@ -376,15 +376,10 @@ parse_opt_set_default_format (const char *format)
     format = system_default_format ? system_default_format : "default";
 
   for (frm = formats; frm->name; frm++)
-    {
-      if (!strcmp (format, frm->name))
-       {
-         default_format = frm->templ;
-         return;
-       }
-    }
-
-  default_format = format;
+    if (!strcmp (format, frm->name)) break;
+  if (frm == NULL || frm->templ == NULL)
+    error (EXIT_FAILURE, 0, "%s: unknown output format", format);
+  default_format = frm->templ;
 }
 
 static int



reply via email to

[Prev in Thread] Current Thread [Next in Thread]