mc0 = mtab_head();
if (!mcprev)
mcprev = mc0;
+
+ /* canonical names in mtab */
for (mc = mcprev->prev; mc && mc != mc0; mc = mc->prev) {
if (streq(mc->m.mnt_fsname, name))
return mc;
}
+
+ /* non-canonical names in mtab (this is BAD THING!) */
+ for (mc = mcprev->prev; mc && mc != mc0; mc = mc->prev) {
+ char *cn = canonicalize(mc->m.mnt_fsname);
+ int res = cn ? streq(cn, name) : 0;
+
+ free(cn);
+ if (res)
+ return mc;
+ }
+
return NULL;
}
mc = getmntdevbackward(file, NULL);
if (mc) {
struct mntentchn *mc1;
+ char *cn;
mc1 = getmntdirbackward(mc->m.mnt_dir, NULL);
if (!mc1)
die(EX_SOFTWARE,
_("umount: confused when analyzing mtab"));
- if (strcmp(file, mc1->m.mnt_fsname)) {
+ cn = canonicalize(mc1->m.mnt_fsname);
+ if (cn && strcmp(file, cn)) {
/* Something was stacked over `file' on the
same mount point. */
die(EX_FAIL, _("umount: cannot unmount %s -- %s is "
"mounted over it on the same point"),
file, mc1->m.mnt_fsname);
}
+ free(cn);
}
}
if (!mc && verbose)