]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
bootspec: it's fine if loader.conf is absent
authorLennart Poettering <lennart@poettering.net>
Fri, 22 Jun 2018 17:31:50 +0000 (19:31 +0200)
committerLennart Poettering <lennart@poettering.net>
Mon, 8 Oct 2018 19:40:44 +0000 (21:40 +0200)
We shouldn't generate an error in that case, as the file is optional.

src/shared/bootspec.c

index 82735833d04844b4a6f1a0af8062fa82749e01ed..ed4cd20bc8679fae16d8f548219723760a6f1a16 100644 (file)
@@ -153,8 +153,12 @@ static int boot_loader_read_conf(const char *path, BootConfig *config) {
         assert(config);
 
         f = fopen(path, "re");
-        if (!f)
+        if (!f) {
+                if (errno == ENOENT)
+                        return 0;
+
                 return log_error_errno(errno, "Failed to open \"%s\": %m", path);
+        }
 
         for (;;) {
                 _cleanup_free_ char *buf = NULL, *field = NULL;
@@ -204,7 +208,7 @@ static int boot_loader_read_conf(const char *path, BootConfig *config) {
                         return log_error_errno(r, "%s:%u: Error while reading: %m", path, line);
         }
 
-        return 0;
+        return 1;
 }
 
 static int boot_entry_compare(const BootEntry *a, const BootEntry *b) {