Patchwork [1/1] e2fsprogs: return error when failed to populate fs

login
register
mail settings
Submitter Robert Yang
Date March 20, 2014, 6:08 a.m.
Message ID <12128e4c5a9ab623fb4ddc8ed6df596d76df3f9d.1395295629.git.liezhi.yang@windriver.com>
Download mbox | patch
Permalink /patch/68915/
State Accepted
Commit 21a3ffb2dc305ab236a006e812007e6c8f665a0e
Headers show

Comments

Robert Yang - March 20, 2014, 6:08 a.m.
We need return retval when "mke2fs -d" failed, otherwise the "$?" would
be 0 which is misleading.

[YOCTO #6011]

Signed-off-by: Robert Yang <liezhi.yang@windriver.com>
---
 ...c-return-error-when-failed-to-populate-fs.patch | 37 ++++++++++++++++++++++
 .../recipes-devtools/e2fsprogs/e2fsprogs_1.42.9.bb |  1 +
 2 files changed, 38 insertions(+)
 create mode 100644 meta/recipes-devtools/e2fsprogs/e2fsprogs/misc-mke2fs.c-return-error-when-failed-to-populate-fs.patch

Patch

diff --git a/meta/recipes-devtools/e2fsprogs/e2fsprogs/misc-mke2fs.c-return-error-when-failed-to-populate-fs.patch b/meta/recipes-devtools/e2fsprogs/e2fsprogs/misc-mke2fs.c-return-error-when-failed-to-populate-fs.patch
new file mode 100644
index 0000000..9b467c3
--- /dev/null
+++ b/meta/recipes-devtools/e2fsprogs/e2fsprogs/misc-mke2fs.c-return-error-when-failed-to-populate-fs.patch
@@ -0,0 +1,37 @@ 
+From e4ffd6fe975888d306b5f700ba54af18b59f6759 Mon Sep 17 00:00:00 2001
+From: Robert Yang <liezhi.yang@windriver.com>
+Date: Thu, 20 Mar 2014 11:10:21 +0800
+Subject: [PATCH] misc/mke2fs.c: return error when failed to populate filesystem
+
+We need return retval when "mke2fs -d" failed, otherwise the "$?" would
+be 0 which is misleading.
+
+Upstream-Status Submitted
+
+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 a63f0b7..846190e 100644
+--- a/misc/mke2fs.c
++++ b/misc/mke2fs.c
+@@ -2745,10 +2745,11 @@ no_journal:
+ 		current_fs = fs;
+ 		root = EXT2_ROOT_INO;
+ 		retval = populate_fs(root, root_dir);
+-		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
+
diff --git a/meta/recipes-devtools/e2fsprogs/e2fsprogs_1.42.9.bb b/meta/recipes-devtools/e2fsprogs/e2fsprogs_1.42.9.bb
index 4114fd2..75a58b5 100644
--- a/meta/recipes-devtools/e2fsprogs/e2fsprogs_1.42.9.bb
+++ b/meta/recipes-devtools/e2fsprogs/e2fsprogs_1.42.9.bb
@@ -17,6 +17,7 @@  SRC_URI += "file://acinclude.m4 \
             file://0010-debugfs-use-the-functions-in-misc-create_inode.c.patch \
             file://0011-mke2fs.8.in-update-the-manual-for-the-d-option.patch \
             file://0001-e2fsprogs-fix-cross-compilation-problem.patch \
+            file://misc-mke2fs.c-return-error-when-failed-to-populate-fs.patch \
 "
 
 SRC_URI[md5sum] = "3f8e41e63b432ba114b33f58674563f7"