From: Karel Zak Date: Fri, 15 Feb 2008 00:56:18 +0000 (+0100) Subject: mount: use canonicalize in getfs_by_devname X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=0230d3beeb0b40d01835eab86fa617b00f3bbc64;p=util-linux mount: use canonicalize in getfs_by_devname Fixes a problem when you define a device via a persistent udev device name in /etc/fstab but use the real block device name on mount invocation. Signed-off-by: Karel Zak --- diff --git a/mount/fstab.c b/mount/fstab.c index 814e6fc0..ada8d322 100644 --- a/mount/fstab.c +++ b/mount/fstab.c @@ -425,9 +425,22 @@ getfs_by_devname (const char *devname) { struct mntentchn *mc, *mc0; mc0 = fstab_head(); + + /* canonical devname in fstab */ for (mc = mc0->nxt; mc && mc != mc0; mc = mc->nxt) if (streq(mc->m.mnt_fsname, devname)) return mc; + + /* noncanonical devname in fstab */ + for (mc = mc0->nxt; mc && mc != mc0; mc = mc->nxt) { + char *fs = canonicalize(mc->m.mnt_fsname); + if (streq(fs, devname)) { + free(fs); + return mc; + } + free(fs); + } + return NULL; }