diff options
author | Heinrich Schuchardt <heinrich.schuchardt@canonical.com> | 2024-02-20 12:54:23 +0100 |
---|---|---|
committer | Tom Rini <trini@konsulko.com> | 2024-03-04 10:25:47 -0500 |
commit | e70f04fb8d69b9e02af608ec4b292bdf2f37c915 (patch) | |
tree | 17be275a389563d34f61f41de620819eab72398d /fs/ext4/ext4fs.c | |
parent | 3766a249a3c0686c690bab1ce31a1c1090c74d29 (diff) |
ext4: detect directories in ext4fs_exists()
While fat_exists() reports directories and files as existing
ext4fs_exists() only recognizes files. This lead to errors
when using systemd-boot with an ext4 file-system.
Change ext4fs_exists() to find any type of inode:
files, directories, symbolic links.
Fixes: a1596438a689 ("ext4fs ls load support")
Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Diffstat (limited to 'fs/ext4/ext4fs.c')
-rw-r--r-- | fs/ext4/ext4fs.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/fs/ext4/ext4fs.c b/fs/ext4/ext4fs.c index 3b12ec54fa2..33e200ffa3c 100644 --- a/fs/ext4/ext4fs.c +++ b/fs/ext4/ext4fs.c @@ -208,11 +208,14 @@ int ext4fs_ls(const char *dirname) int ext4fs_exists(const char *filename) { - loff_t file_len; - int ret; + struct ext2fs_node *dirnode = NULL; + int filetype; - ret = ext4fs_open(filename, &file_len); - return ret == 0; + if (!filename) + return 0; + + return ext4fs_find_file1(filename, &ext4fs_root->diropen, &dirnode, + &filetype); } int ext4fs_size(const char *filename, loff_t *size) |