Whamcloud - gitweb
mke2fs: Do not let -t or -T be specified more than once
authorEric Sandeen <sandeen@redhat.com>
Fri, 16 Sep 2011 20:49:32 +0000 (15:49 -0500)
committerTheodore Ts'o <tytso@mit.edu>
Fri, 16 Sep 2011 22:45:14 +0000 (18:45 -0400)
In addition to not making sense, it causes a memory leak
when fs_type gets overwritten.

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
misc/mke2fs.c

index 437b495..ff5d54b 100644 (file)
@@ -1445,9 +1445,19 @@ profile_error:
                        super_only = 1;
                        break;
                case 't':
+                       if (fs_type) {
+                               com_err(program_name, 0,
+                                   _("The -t option may only be used once"));
+                               exit(1);
+                       }
                        fs_type = strdup(optarg);
                        break;
                case 'T':
+                       if (usage_types) {
+                               com_err(program_name, 0,
+                                   _("The -T option may only be used once"));
+                               exit(1);
+                       }
                        usage_types = strdup(optarg);
                        break;
                case 'U':