]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
wipefs: use symbolic value for markup mode
authorSami Kerola <kerolasa@iki.fi>
Sun, 10 Jun 2012 20:20:34 +0000 (22:20 +0200)
committerSami Kerola <kerolasa@iki.fi>
Mon, 11 Jun 2012 20:06:05 +0000 (22:06 +0200)
In case mode value is found to be out of bounds program will crash.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
misc-utils/wipefs.c

index e0ced2f6944b10ff9c726fc8c2a0258ced114895..259ca3766ce7c54a31f8f82daf71f77182a29bb3 100644 (file)
@@ -56,8 +56,10 @@ struct wipe_desc {
        struct wipe_desc        *next;
 };
 
-#define WP_MODE_PRETTY         0               /* default */
-#define WP_MODE_PARSABLE       1
+enum {
+       WP_MODE_PRETTY,         /* default */
+       WP_MODE_PARSABLE
+};
 
 static const char *type_pattern;
 
@@ -117,6 +119,8 @@ print_all(struct wipe_desc *wp, int mode)
                case WP_MODE_PARSABLE:
                        print_parsable(wp, n++);
                        break;
+               default:
+                       abort();
                }
                wp = wp->next;
        }
@@ -375,7 +379,8 @@ int
 main(int argc, char **argv)
 {
        struct wipe_desc *wp0 = NULL, *wp;
-       int c, all = 0, has_offset = 0, noact = 0, mode = 0, quiet = 0;
+       int c, all = 0, has_offset = 0, noact = 0, quiet = 0;
+       int mode = WP_MODE_PRETTY;
 
        static const struct option longopts[] = {
            { "all",       0, 0, 'a' },