From fc53809803cd2bc2434e312b19a18fa36776da12 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Wed, 12 Jun 2024 05:50:40 +0200 Subject: Adding upstream version 256. Signed-off-by: Daniel Baumann --- src/shared/mkfs-util.c | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) (limited to 'src/shared/mkfs-util.c') diff --git a/src/shared/mkfs-util.c b/src/shared/mkfs-util.c index 4e58b6e..4d44012 100644 --- a/src/shared/mkfs-util.c +++ b/src/shared/mkfs-util.c @@ -104,7 +104,6 @@ static int mangle_fat_label(const char *s, char **ret) { static int do_mcopy(const char *node, const char *root) { _cleanup_free_ char *mcopy = NULL; _cleanup_strv_free_ char **argv = NULL; - _cleanup_close_ int rfd = -EBADF; _cleanup_free_ DirectoryEntries *de = NULL; int r; @@ -128,11 +127,7 @@ static int do_mcopy(const char *node, const char *root) { /* mcopy copies the top level directory instead of everything in it so we have to pass all * the subdirectories to mcopy instead to end up with the correct directory structure. */ - rfd = open(root, O_RDONLY|O_DIRECTORY|O_CLOEXEC); - if (rfd < 0) - return log_error_errno(errno, "Failed to open directory '%s': %m", root); - - r = readdir_all(rfd, RECURSE_DIR_SORT|RECURSE_DIR_ENSURE_TYPE, &de); + r = readdir_all_at(AT_FDCWD, root, RECURSE_DIR_SORT|RECURSE_DIR_ENSURE_TYPE, &de); if (r < 0) return log_error_errno(r, "Failed to read '%s' contents: %m", root); @@ -430,7 +425,7 @@ int make_filesystem( "-T", "default", node); - if (root && strv_extend_strv(&argv, STRV_MAKE("-d", root), false) < 0) + if (root && strv_extend_many(&argv, "-d", root) < 0) return log_oom(); if (quiet && strv_extend(&argv, "-q") < 0) @@ -455,7 +450,7 @@ int make_filesystem( if (!discard && strv_extend(&argv, "--nodiscard") < 0) return log_oom(); - if (root && strv_extend_strv(&argv, STRV_MAKE("-r", root), false) < 0) + if (root && strv_extend_many(&argv, "-r", root) < 0) return log_oom(); if (quiet && strv_extend(&argv, "-q") < 0) @@ -519,7 +514,7 @@ int make_filesystem( if (!protofile_with_opt) return -ENOMEM; - if (strv_extend_strv(&argv, STRV_MAKE("-p", protofile_with_opt), false) < 0) + if (strv_extend_many(&argv, "-p", protofile_with_opt) < 0) return log_oom(); } -- cgit v1.2.3