]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
gpt-auto: don't assume XBOOTLDR is vfat
authorLennart Poettering <lennart@poettering.net>
Tue, 7 Jan 2020 16:21:24 +0000 (17:21 +0100)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Wed, 8 Jan 2020 08:51:42 +0000 (09:51 +0100)
Let's not assume "umask=" is a valid mount option for XBOOTLDR
partitions unconditionally.

Fixes: #14165
src/gpt-auto-generator/gpt-auto-generator.c

index 4aac903aa6c7f33bb82535f73f380a208452a552..af3bd2345041a8563ef9f7d9d55efb3eb7fe4413 100644 (file)
@@ -443,6 +443,19 @@ static int add_automount(
         return generator_add_symlink(arg_dest, SPECIAL_LOCAL_FS_TARGET, "wants", unit);
 }
 
+static const char *esp_or_xbootldr_options(const DissectedPartition *p) {
+        assert(p);
+
+        /* if we probed vfat or have no idea about the file system then assume these file systems are vfat
+         * and thus understand "umask=0077". If we detected something else then don't specify any options and
+         * use kernel defaults. */
+
+        if (!p->fstype || streq(p->fstype, "vfat"))
+                return "umask=0077";
+
+        return NULL;
+}
+
 static int add_xbootldr(DissectedPartition *p) {
         int r;
 
@@ -472,7 +485,7 @@ static int add_xbootldr(DissectedPartition *p) {
                              "/boot",
                              p->fstype,
                              true,
-                             "umask=0077",
+                             esp_or_xbootldr_options(p),
                              "Boot Loader Partition",
                              120 * USEC_PER_SEC);
 }
@@ -546,7 +559,7 @@ static int add_esp(DissectedPartition *p, bool has_xbootldr) {
                              esp_path,
                              p->fstype,
                              true,
-                             "umask=0077",
+                             esp_or_xbootldr_options(p),
                              "EFI System Partition Automount",
                              120 * USEC_PER_SEC);
 }