]> err.no Git - systemd/commitdiff
mount: don't fail if fstab doesn't exist
authorLennart Poettering <lennart@poettering.net>
Sun, 22 Apr 2012 13:33:43 +0000 (15:33 +0200)
committerLennart Poettering <lennart@poettering.net>
Sun, 22 Apr 2012 13:33:43 +0000 (15:33 +0200)
src/core/mount.c
src/cryptsetup/cryptsetup.c
src/remount-api-vfs/remount-api-vfs.c

index 760ffcdbf6e983542828e876fc3a4a9ef1bd67ee..dbd4893bcbdcafd05e89cf1dcf79f04a3504ed10 100644 (file)
@@ -1537,8 +1537,9 @@ static int mount_load_etc_fstab(Manager *m) {
         assert(m);
 
         errno = 0;
-        if (!(f = setmntent("/etc/fstab", "r")))
-                return -errno;
+        f = setmntent("/etc/fstab", "r");
+        if (!f)
+                return errno == ENOENT ? 0 : -errno;
 
         while ((me = getmntent(f))) {
                 char *where, *what;
index f214d60d569fda55c0edadc0ab8359ca9c382666..3ff0ddf2cc8b2285e554e3fc264716e2ef369327 100644 (file)
@@ -190,7 +190,8 @@ static char *disk_mount_point(const char *label) {
         if (asprintf(&device, "/dev/mapper/%s", label) < 0)
                 goto finish;
 
-        if (!(f = setmntent("/etc/fstab", "r")))
+        f = setmntent("/etc/fstab", "r");
+        if (!f)
                 goto finish;
 
         while ((m = getmntent(f)))
index 6cb77c1d1a1ef02e9ab715ebdbf4de50c8729f20..373ae2552047287decc6251de9ca5aebc2b6726b 100644 (file)
@@ -56,6 +56,11 @@ int main(int argc, char *argv[]) {
 
         f = setmntent("/etc/fstab", "r");
         if (!f) {
+                if (errno == ENOENT) {
+                        ret = EXIT_SUCCESS;
+                        goto finish;
+                }
+
                 log_error("Failed to open /etc/fstab: %m");
                 goto finish;
         }