diff mbox series

init: fix error check in clean_path()

Message ID 20200904135332.1130070-1-brho@google.com (mailing list archive)
State New, archived
Headers show
Series init: fix error check in clean_path() | expand

Commit Message

Barret Rhoden Sept. 4, 2020, 1:53 p.m. UTC
init_stat() returns 0 on success, same as vfs_lstat().  When it replaced
vfs_lstat(), the '!' was dropped.

Fixes: 716308a5331b ("init: add an init_stat helper")
Signed-off-by: Barret Rhoden <brho@google.com>
---

Andy: this was broken in virtme.  "/init: source: not found"

 init/initramfs.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Christoph Hellwig Sept. 4, 2020, 4:04 p.m. UTC | #1
On Fri, Sep 04, 2020 at 09:53:32AM -0400, Barret Rhoden wrote:
> init_stat() returns 0 on success, same as vfs_lstat().  When it replaced
> vfs_lstat(), the '!' was dropped.
> 
> Fixes: 716308a5331b ("init: add an init_stat helper")
> Signed-off-by: Barret Rhoden <brho@google.com>

Looks good,

Reviewed-by: Christoph Hellwig <hch@lst.de>
diff mbox series

Patch

diff --git a/init/initramfs.c b/init/initramfs.c
index e6dbfb767057..1f97c0328a7a 100644
--- a/init/initramfs.c
+++ b/init/initramfs.c
@@ -297,7 +297,7 @@  static void __init clean_path(char *path, umode_t fmode)
 {
 	struct kstat st;
 
-	if (init_stat(path, &st, AT_SYMLINK_NOFOLLOW) &&
+	if (!init_stat(path, &st, AT_SYMLINK_NOFOLLOW) &&
 	    (st.mode ^ fmode) & S_IFMT) {
 		if (S_ISDIR(st.mode))
 			init_rmdir(path);