linux-ext4.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH V2] e2fsprogs: misc/mke2fs.c: return error when failed to populate fs
@ 2014-03-27  2:03 Robert Yang
  2014-03-30  9:08 ` Zheng Liu
  0 siblings, 1 reply; 3+ messages in thread
From: Robert Yang @ 2014-03-27  2:03 UTC (permalink / raw)
  To: tytso; +Cc: linux-ext4, gnehzuil.liu

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 | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/misc/mke2fs.c b/misc/mke2fs.c
index aecd5d5..60e7466 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)
-			fprintf(stderr, "%s",
-				_("\nError while populating file system"));
-		else if (!quiet)
+		if (retval) {
+			com_err(program_name, retval, "%s",
+				_("\nError while populating file system\n"));
+			exit(1);
+		} else if (!quiet)
 			printf("%s", _("done\n"));
 	}
 
-- 
1.8.3.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH V2] e2fsprogs: misc/mke2fs.c: return error when failed to populate fs
  2014-03-27  2:03 [PATCH V2] e2fsprogs: misc/mke2fs.c: return error when failed to populate fs Robert Yang
@ 2014-03-30  9:08 ` Zheng Liu
  2014-04-14 15:44   ` Theodore Ts'o
  0 siblings, 1 reply; 3+ messages in thread
From: Zheng Liu @ 2014-03-30  9:08 UTC (permalink / raw)
  To: Robert Yang; +Cc: tytso, linux-ext4

On Thu, Mar 27, 2014 at 10:03:07AM +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>

Thanks for fixing this.
Reviewed-by: Zheng Liu <wenqing.lz@taobao.com>

                                                - Zheng

> ---
>  misc/mke2fs.c | 9 +++++----
>  1 file changed, 5 insertions(+), 4 deletions(-)
> 
> diff --git a/misc/mke2fs.c b/misc/mke2fs.c
> index aecd5d5..60e7466 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)
> -			fprintf(stderr, "%s",
> -				_("\nError while populating file system"));
> -		else if (!quiet)
> +		if (retval) {
> +			com_err(program_name, retval, "%s",
> +				_("\nError while populating file system\n"));
> +			exit(1);
> +		} else if (!quiet)
>  			printf("%s", _("done\n"));
>  	}
>  
> -- 
> 1.8.3.1
> 

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH V2] e2fsprogs: misc/mke2fs.c: return error when failed to populate fs
  2014-03-30  9:08 ` Zheng Liu
@ 2014-04-14 15:44   ` Theodore Ts'o
  0 siblings, 0 replies; 3+ messages in thread
From: Theodore Ts'o @ 2014-04-14 15:44 UTC (permalink / raw)
  To: Robert Yang, linux-ext4

On Sun, Mar 30, 2014 at 05:08:25PM +0800, Zheng Liu wrote:
> On Thu, Mar 27, 2014 at 10:03:07AM +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>
> 
> Thanks for fixing this.
> Reviewed-by: Zheng Liu <wenqing.lz@taobao.com>

Thanks, applied.

						- Ted

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2014-04-14 15:44 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-03-27  2:03 [PATCH V2] e2fsprogs: misc/mke2fs.c: return error when failed to populate fs Robert Yang
2014-03-30  9:08 ` Zheng Liu
2014-04-14 15:44   ` Theodore Ts'o

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).