]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
bootctl: use the fact that startswith() returns the suffix
authorLennart Poettering <lennart@poettering.net>
Fri, 19 Jul 2019 16:27:10 +0000 (18:27 +0200)
committerLennart Poettering <lennart@poettering.net>
Thu, 25 Jul 2019 15:10:51 +0000 (17:10 +0200)
src/boot/bootctl.c

index d570526a4fd154e2fec96fd7c484236554de2466..f786c8d1e96da5e162c57e23fe393267671729f6 100644 (file)
@@ -603,6 +603,7 @@ static int create_esp_subdirs(const char *esp_path) {
 }
 
 static int copy_one_file(const char *esp_path, const char *name, bool force) {
+        const char *e;
         char *p, *q;
         int r;
 
@@ -610,13 +611,13 @@ static int copy_one_file(const char *esp_path, const char *name, bool force) {
         q = strjoina(esp_path, "/EFI/systemd/", name);
         r = copy_file_with_version_check(p, q, force);
 
-        if (startswith(name, "systemd-boot")) {
+        e = startswith(name, "systemd-boot");
+        if (e) {
                 int k;
                 char *v;
 
                 /* Create the EFI default boot loader name (specified for removable devices) */
-                v = strjoina(esp_path, "/EFI/BOOT/BOOT",
-                             name + STRLEN("systemd-boot"));
+                v = strjoina(esp_path, "/EFI/BOOT/BOOT", e);
                 ascii_strupper(strrchr(v, '/') + 1);
 
                 k = copy_file_with_version_check(p, v, force);