device: fix missing error path in btrfs mount detection
authorZdenek Kabelac <zkabelac@redhat.com>
Fri, 7 Nov 2025 21:46:56 +0000 (22:46 +0100)
committerZdenek Kabelac <zkabelac@redhat.com>
Mon, 10 Nov 2025 14:52:23 +0000 (15:52 +0100)
Add missing error handling when opendir() fails with non-ENOENT errors.
Previously would continue to readdir(NULL) causing undefined behavior.

Found by clang static analysis.

lib/device/filesystem.c

index cd54e7b2be2d7f6607bc6b54b3e3ff6a6af8e6dd..fb4cdb7dc5d9b2dc4076f649f729484c22491e75 100644 (file)
@@ -181,6 +181,8 @@ static int _btrfs_get_mnt(struct fs_info *fsi, dev_t lv_devt)
                        fsi->mounted = 0;
                        return 1;
                }
+               log_sys_error("opendir", devices_path);
+               return 0;
        }
 
        /*
This page took 0.09486 seconds and 5 git commands to generate.