diff options
Diffstat (limited to 'sutils/fstab.c')
-rw-r--r-- | sutils/fstab.c | 26 |
1 files changed, 24 insertions, 2 deletions
diff --git a/sutils/fstab.c b/sutils/fstab.c index e40572e2..b66e5195 100644 --- a/sutils/fstab.c +++ b/sutils/fstab.c @@ -497,7 +497,29 @@ fstab_find_mount (const struct fstab *fstab, const char *name) inline struct fs * fstab_find (const struct fstab *fstab, const char *name) { - return fstab_find_device (fstab, name) ?: fstab_find_mount (fstab, name); + struct fs *ret; + const char *real_name; + + ret = fstab_find_device (fstab, name); + if (ret) + return ret; + + ret = fstab_find_mount (fstab, name); + if (ret) + return ret; + + real_name = realpath (name, NULL); + + ret = fstab_find_device (fstab, real_name); + if (ret) { + free (real_name); + return ret; + } + + ret = fstab_find_mount (fstab, real_name); + free (real_name); + + return ret; } /* Cons FS onto the beginning of FSTAB's entry list. */ @@ -571,7 +593,7 @@ fstab_add_mntent (struct fstab *const fstab, const struct mntent *mntent, free (fs); } - if (!err && mounted_fs) + if (!err && mounted_fs && mounted_fs != fs) /* Get rid of the conflicting entry MOUNTED_FS. */ fs_free (mounted_fs); |