* [PATCH] e2fsprogs: misc/mke2fs.c: return error when failed to populate fs
@ 2014-03-20 6:09 Robert Yang
2014-03-22 4:11 ` Zheng Liu
0 siblings, 1 reply; 3+ messages in thread
From: Robert Yang @ 2014-03-20 6:09 UTC (permalink / raw)
To: tytso; +Cc: linux-ext4
We need return retval when "mke2fs -d" failed, otherwise the "$?" would
be 0 which is misleading.
Signed-off-by: Robert Yang <liezhi.yang@windriver.com>
---
misc/mke2fs.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/misc/mke2fs.c b/misc/mke2fs.c
index aecd5d5..f659e6f 100644
--- a/misc/mke2fs.c
+++ b/misc/mke2fs.c
@@ -2990,10 +2990,11 @@ no_journal:
retval = populate_fs(fs, EXT2_ROOT_INO, root_dir,
EXT2_ROOT_INO);
- if (retval)
+ if (retval) {
fprintf(stderr, "%s",
- _("\nError while populating file system"));
- else if (!quiet)
+ _("\nError while populating file system\n"));
+ return retval;
+ } else if (!quiet)
printf("%s", _("done\n"));
}
--
1.8.3.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] e2fsprogs: misc/mke2fs.c: return error when failed to populate fs
2014-03-20 6:09 [PATCH] e2fsprogs: misc/mke2fs.c: return error when failed to populate fs Robert Yang
@ 2014-03-22 4:11 ` Zheng Liu
2014-03-27 1:55 ` Robert Yang
0 siblings, 1 reply; 3+ messages in thread
From: Zheng Liu @ 2014-03-22 4:11 UTC (permalink / raw)
To: Robert Yang; +Cc: tytso, linux-ext4
On Thu, Mar 20, 2014 at 02:09:26PM +0800, Robert Yang wrote:
> We need return retval when "mke2fs -d" failed, otherwise the "$?" would
> be 0 which is misleading.
>
> Signed-off-by: Robert Yang <liezhi.yang@windriver.com>
> ---
> misc/mke2fs.c | 7 ++++---
> 1 file changed, 4 insertions(+), 3 deletions(-)
>
> diff --git a/misc/mke2fs.c b/misc/mke2fs.c
> index aecd5d5..f659e6f 100644
> --- a/misc/mke2fs.c
> +++ b/misc/mke2fs.c
> @@ -2990,10 +2990,11 @@ no_journal:
>
> retval = populate_fs(fs, EXT2_ROOT_INO, root_dir,
> EXT2_ROOT_INO);
> - if (retval)
> + if (retval) {
> fprintf(stderr, "%s",
> - _("\nError while populating file system"));
^^^
Using com_err() is sane. After we get an error, the user can know which
error has occured.
> - else if (!quiet)
> + _("\nError while populating file system\n"));
> + return retval;
^^^^
Maybe exit(1) is better. We just need to notify the user that an error
has occured. An internal error of libext2fs should not be returned
to user.
Regards,
- Zheng
> + } else if (!quiet)
> printf("%s", _("done\n"));
> }
>
> --
> 1.8.3.1
>
> --
> 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
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] e2fsprogs: misc/mke2fs.c: return error when failed to populate fs
2014-03-22 4:11 ` Zheng Liu
@ 2014-03-27 1:55 ` Robert Yang
0 siblings, 0 replies; 3+ messages in thread
From: Robert Yang @ 2014-03-27 1:55 UTC (permalink / raw)
To: linux-ext4, Zheng Liu; +Cc: tytso
Hello Zheng,
Thanks for your comments, V2 is comming.
// Robert
On 03/22/2014 12:11 PM, Zheng Liu wrote:
> On Thu, Mar 20, 2014 at 02:09:26PM +0800, Robert Yang wrote:
>> We need return retval when "mke2fs -d" failed, otherwise the "$?" would
>> be 0 which is misleading.
>>
>> Signed-off-by: Robert Yang <liezhi.yang@windriver.com>
>> ---
>> misc/mke2fs.c | 7 ++++---
>> 1 file changed, 4 insertions(+), 3 deletions(-)
>>
>> diff --git a/misc/mke2fs.c b/misc/mke2fs.c
>> index aecd5d5..f659e6f 100644
>> --- a/misc/mke2fs.c
>> +++ b/misc/mke2fs.c
>> @@ -2990,10 +2990,11 @@ no_journal:
>>
>> retval = populate_fs(fs, EXT2_ROOT_INO, root_dir,
>> EXT2_ROOT_INO);
>> - if (retval)
>> + if (retval) {
>> fprintf(stderr, "%s",
>> - _("\nError while populating file system"));
> ^^^
> Using com_err() is sane. After we get an error, the user can know which
> error has occured.
>> - else if (!quiet)
>> + _("\nError while populating file system\n"));
>> + return retval;
> ^^^^
> Maybe exit(1) is better. We just need to notify the user that an error
> has occured. An internal error of libext2fs should not be returned
> to user.
>
> Regards,
> - Zheng
>
>> + } else if (!quiet)
>> printf("%s", _("done\n"));
>> }
>>
>> --
>> 1.8.3.1
>>
>> --
>> 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
>
>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2014-03-27 1:55 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-03-20 6:09 [PATCH] e2fsprogs: misc/mke2fs.c: return error when failed to populate fs Robert Yang
2014-03-22 4:11 ` Zheng Liu
2014-03-27 1:55 ` Robert Yang
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).