Skip to content

Commit

Permalink
init: fix error check in clean_path()
Browse files Browse the repository at this point in the history
init_stat() returns 0 on success, same as vfs_lstat().  When it replaced
vfs_lstat(), the '!' was dropped.

Fixes: 716308a ("init: add an init_stat helper")
Signed-off-by: Barret Rhoden <[email protected]>
Reviewed-by: Christoph Hellwig <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
Barret Rhoden authored and torvalds committed Sep 4, 2020
1 parent 5912690 commit 7b81ce7
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion init/initramfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 7b81ce7

Please sign in to comment.