chiark / gitweb /
fstab-generator: properly detect bind mounts
authorLennart Poettering <lennart@poettering.net>
Mon, 24 Dec 2012 12:01:00 +0000 (13:01 +0100)
committerLennart Poettering <lennart@poettering.net>
Mon, 24 Dec 2012 12:01:00 +0000 (13:01 +0100)
This kinda undoes a83cbaccd03c3f28e47e9330f4a22ff65ce4b561 and
1d634e21b453f3c80d7c6c4bd90a6b84e42a3d2a but corrects the original code
to compare the mount type with "bind" rather than the mount options.

src/fstab-generator/fstab-generator.c

index ba55f2c2b73d0ce09bbd59232b4cbbe54c94e998..23e5051925429ed48fa5adbf0dcbdec2849641ae 100644 (file)
@@ -194,6 +194,14 @@ finish:
         return r;
 }
 
         return r;
 }
 
+static bool mount_is_bind(struct mntent *me) {
+        assert(me);
+
+        return
+                hasmntopt(me, "bind") ||
+                streq(me->mnt_type, "bind");
+}
+
 static bool mount_is_network(struct mntent *me) {
         assert(me);
 
 static bool mount_is_network(struct mntent *me) {
         assert(me);
 
@@ -226,7 +234,7 @@ static int add_mount(const char *what, const char *where, struct mntent *me) {
                 return 0;
 
         isnetwork = mount_is_network(me);
                 return 0;
 
         isnetwork = mount_is_network(me);
-        isbind = !!hasmntopt(me, "bind");
+        isbind = mount_is_bind(me);
 
         noauto = !!hasmntopt(me, "noauto");
         nofail = !!hasmntopt(me, "nofail");
 
         noauto = !!hasmntopt(me, "noauto");
         nofail = !!hasmntopt(me, "nofail");