[PATCH 17/25] mke2fs: Do not let -t or -T be specified more than once

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

 



In addition to not making since, it causes a memory leak
when fs_type gets overwritten.

Signed-off-by: Eric Sandeen <sandeen@xxxxxxxxxx>
---
 misc/mke2fs.c |   10 ++++++++++
 1 files changed, 10 insertions(+), 0 deletions(-)

diff --git a/misc/mke2fs.c b/misc/mke2fs.c
index 437b495..e30c070 100644
--- a/misc/mke2fs.c
+++ b/misc/mke2fs.c
@@ -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':
-- 
1.7.4.1

--
To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Reiser Filesystem Development]     [Ceph FS]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Linux FS]     [Yosemite National Park]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Device Mapper]     [Linux Media]

  Powered by Linux