]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
boot: a couple of tweaks recommended by Coccinelle
authorFrantisek Sumsal <frantisek@sumsal.cz>
Mon, 25 Jul 2022 07:49:39 +0000 (09:49 +0200)
committerLennart Poettering <lennart@poettering.net>
Mon, 25 Jul 2022 10:47:23 +0000 (12:47 +0200)
src/boot/bootctl.c
src/shared/find-esp.c

index c09c305b3f3f1c042c0cdec7a88b7f3bb3b3f1cd..7470157ecd5652d7e8647c2e6e52270ea7fe816c 100644 (file)
@@ -872,7 +872,7 @@ static int copy_one_file(const char *esp_path, const char *name, bool force) {
                                        "Failed to resolve path %s%s%s: %m",
                                        p,
                                        root ? " under directory " : "",
-                                       root ?: "");
+                                       strempty(root));
 
         q = path_join("/EFI/systemd/", dest_name);
         if (!q)
@@ -918,7 +918,7 @@ static int install_binaries(const char *esp_path, const char *arch, bool force)
         if (r == -ENOENT && root && arg_install_source == ARG_INSTALL_SOURCE_AUTO)
                 r = chase_symlinks_and_opendir(BOOTLIBDIR, NULL, CHASE_PREFIX_ROOT, &path, &d);
         if (r < 0)
-                return log_error_errno(r, "Failed to open boot loader directory %s%s: %m", root ?: "", BOOTLIBDIR);
+                return log_error_errno(r, "Failed to open boot loader directory %s%s: %m", strempty(root), BOOTLIBDIR);
 
         const char *suffix = strjoina(arch, ".efi");
         const char *suffix_signed = strjoina(arch, ".efi.signed");
index 87ac9d167efa52e9df982fec49c10bbb8beba63f..14c1ce0b45c163954c4b3361a9db83cabfb626c8 100644 (file)
@@ -416,7 +416,7 @@ int find_esp_and_warn(
                                                "Failed to resolve path %s%s%s: %m",
                                                path,
                                                root ? " under directory " : "",
-                                               root ?: "");
+                                               strempty(root));
 
                 r = verify_esp(p, ret_part, ret_pstart, ret_psize, ret_uuid, ret_devid, flags);
                 if (r < 0)
@@ -435,7 +435,7 @@ int find_esp_and_warn(
                                                "Failed to resolve path %s%s%s: %m",
                                                path,
                                                root ? " under directory " : "",
-                                               root ?: "");
+                                               strempty(root));
 
                 if (!path_is_valid(p) || !path_is_absolute(p))
                         return log_error_errno(SYNTHETIC_ERRNO(EINVAL),
@@ -474,7 +474,7 @@ int find_esp_and_warn(
                                                "Failed to resolve path %s%s%s: %m",
                                                dir,
                                                root ? " under directory " : "",
-                                               root ?: "");
+                                               strempty(root));
 
                 r = verify_esp(p, ret_part, ret_pstart, ret_psize, ret_uuid, ret_devid,
                                flags | VERIFY_ESP_SEARCHING);
@@ -712,7 +712,7 @@ int find_xbootldr_and_warn(
                                                "Failed to resolve path %s%s%s: %m",
                                                path,
                                                root ? " under directory " : "",
-                                               root ?: "");
+                                               strempty(root));
 
                 r = verify_xbootldr(p, /* searching= */ false, unprivileged_mode, ret_uuid, ret_devid);
                 if (r < 0)
@@ -731,7 +731,7 @@ int find_xbootldr_and_warn(
                                                "Failed to resolve path %s%s%s: %m",
                                                path,
                                                root ? " under directory " : "",
-                                               root ?: "");
+                                               strempty(root));
 
                 if (!path_is_valid(p) || !path_is_absolute(p))
                         return log_error_errno(SYNTHETIC_ERRNO(EINVAL),
@@ -758,7 +758,7 @@ int find_xbootldr_and_warn(
                 return log_error_errno(r,
                                        "Failed to resolve path /boot%s%s: %m",
                                        root ? " under directory " : "",
-                                       root ?: "");
+                                       strempty(root));
 
         r = verify_xbootldr(p, true, unprivileged_mode, ret_uuid, ret_devid);
         if (r >= 0)