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

login
register
mail settings
Submitter Eric Sandeen
Date Sept. 16, 2011, 8:49 p.m.
Message ID <1316206180-6375-18-git-send-email-sandeen@redhat.com>
Download mbox | patch
Permalink /patch/115037/
State Accepted
Headers show

Comments

Eric Sandeen - Sept. 16, 2011, 8:49 p.m.
In addition to not making since, it causes a memory leak
when fs_type gets overwritten.

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
---
 misc/mke2fs.c |   10 ++++++++++
 1 files changed, 10 insertions(+), 0 deletions(-)
Theodore Ts'o - Sept. 16, 2011, 10:57 p.m.
On Fri, Sep 16, 2011 at 03:49:32PM -0500, Eric Sandeen wrote:
> In addition to not making since, it causes a memory leak
> when fs_type gets overwritten.
> 
> Signed-off-by: Eric Sandeen <sandeen@redhat.com>

Applied, with whitespace cleanups.

					- Ted
--
To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Theodore Ts'o - Sept. 16, 2011, 10:57 p.m.
On Fri, Sep 16, 2011 at 06:57:20PM -0400, Ted Ts'o wrote:
> On Fri, Sep 16, 2011 at 03:49:32PM -0500, Eric Sandeen wrote:
> > In addition to not making since, it causes a memory leak
> > when fs_type gets overwritten.
> > 
> > Signed-off-by: Eric Sandeen <sandeen@redhat.com>
> 
> Applied, with whitespace cleanups.

Oh, and s/since/sense/

					- Ted
--
To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Eric Sandeen - Sept. 17, 2011, 12:49 a.m.
On 9/16/11 5:57 PM, Ted Ts'o wrote:
> On Fri, Sep 16, 2011 at 06:57:20PM -0400, Ted Ts'o wrote:
>> On Fri, Sep 16, 2011 at 03:49:32PM -0500, Eric Sandeen wrote:
>>> In addition to not making since, it causes a memory leak
>>> when fs_type gets overwritten.
>>>
>>> Signed-off-by: Eric Sandeen <sandeen@redhat.com>
>>
>> Applied, with whitespace cleanups.
> 
> Oh, and s/since/sense/
> 
> 					- Ted

whoops thanks.

Usually my English is ok, sorry!  ;)
--
To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Patch

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':