utils: don't deref after NULL check

Fixes: Coverity 1465855 Signed-off-by: 's avatarChristian Brauner <christian.brauner@ubuntu.com>
parent ec0befee
...@@ -1113,7 +1113,7 @@ int safe_mount_beneath(const char *beneath, const char *src, const char *dst, co ...@@ -1113,7 +1113,7 @@ int safe_mount_beneath(const char *beneath, const char *src, const char *dst, co
__do_close int beneath_fd = -EBADF; __do_close int beneath_fd = -EBADF;
const char *path = beneath ? beneath : "/"; const char *path = beneath ? beneath : "/";
beneath_fd = openat(-1, beneath, O_RDONLY | O_CLOEXEC | O_DIRECTORY | O_PATH); beneath_fd = openat(-1, path, O_RDONLY | O_CLOEXEC | O_DIRECTORY | O_PATH);
if (beneath_fd < 0) if (beneath_fd < 0)
return log_error_errno(-errno, errno, "Failed to open %s", path); return log_error_errno(-errno, errno, "Failed to open %s", path);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment