struct mntentchn *
getfs_by_dir (const char *dir) {
struct mntentchn *mc, *mc0;
+ char *cdir;
mc0 = fstab_head();
for (mc = mc0->nxt; mc && mc != mc0; mc = mc->nxt)
if (streq(mc->m.mnt_dir, dir))
return mc;
+
+ cdir = canonicalize(dir);
+ for (mc = mc0->nxt; mc && mc != mc0; mc = mc->nxt) {
+ if (streq(mc->m.mnt_dir, cdir)) {
+ free(cdir);
+ return mc;
+ }
+ }
+ free(cdir);
return NULL;
}
/* Find the device SPEC in fstab. */
struct mntentchn *
getfs_by_spec (const char *spec) {
- char *name, *value;
+ char *name, *value, *cspec;
struct mntentchn *mc = NULL;
if (!spec)
free((void *) name);
return mc;
}
- return getfs_by_devname(spec);
+
+ cspec = canonicalize(spec);
+ mc = getfs_by_devname(cspec);
+ free(cspec);
+
+ if (!mc)
+ /* noncanonical name like /dev/cdrom */
+ mc = getfs_by_devname(spec);
+
+ return mc;
}
/* Find the device in fstab. */