diff options
author | Rohith Surabattula <rohiths@microsoft.com> | 2020-11-06 10:19:59 +0000 |
---|---|---|
committer | Pavel Shilovsky <pshilov@microsoft.com> | 2020-11-09 15:16:50 -0800 |
commit | 1f37d9c1b7c209c438871bdf5aa0d42124f42d4f (patch) | |
tree | 5fb4d7fcd5eac8a66829405534ca0dbea220b508 /mount.cifs.c | |
parent | 1252355e7c422e5f40e93c1b5c681f8f90a83d47 (diff) | |
download | cifs-utils-1f37d9c1b7c209c438871bdf5aa0d42124f42d4f.tar.gz cifs-utils-1f37d9c1b7c209c438871bdf5aa0d42124f42d4f.tar.bz2 cifs-utils-1f37d9c1b7c209c438871bdf5aa0d42124f42d4f.zip |
Fix mount error when mount point has an extra trailing slash.
Diffstat (limited to 'mount.cifs.c')
-rw-r--r-- | mount.cifs.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/mount.cifs.c b/mount.cifs.c index 5d43c00..81bdbc8 100644 --- a/mount.cifs.c +++ b/mount.cifs.c @@ -221,6 +221,7 @@ check_fstab(const char *progname, const char *mountpoint, const char *devname, { FILE *fstab; struct mntent *mnt; + size_t len; /* make sure this mount is listed in /etc/fstab */ fstab = setmntent(_PATH_MNTTAB, "r"); @@ -230,6 +231,14 @@ check_fstab(const char *progname, const char *mountpoint, const char *devname, } while ((mnt = getmntent(fstab))) { + len = strlen(mnt->mnt_dir); + while (len > 1) { + if (mnt->mnt_dir[len - 1] == '/') + mnt->mnt_dir[len - 1] = '\0'; + else + break; + len--; + } if (!strcmp(mountpoint, mnt->mnt_dir)) break; } |