From: Sami Kerola Date: Sun, 10 Jun 2012 20:20:34 +0000 (+0200) Subject: wipefs: use symbolic value for markup mode X-Git-Tag: v2.22-rc1~277^2~2 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=4f0537374f8cdaf2408a29c4c870f29255947173;p=thirdparty%2Futil-linux.git wipefs: use symbolic value for markup mode In case mode value is found to be out of bounds program will crash. Signed-off-by: Sami Kerola --- diff --git a/misc-utils/wipefs.c b/misc-utils/wipefs.c index e0ced2f694..259ca3766c 100644 --- a/misc-utils/wipefs.c +++ b/misc-utils/wipefs.c @@ -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' },