git.samba.org
/
cifs-utils.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
1252355
)
Fix mount error when mount point has an extra trailing slash.
author
Rohith Surabattula
<rohiths@microsoft.com>
Fri, 6 Nov 2020 10:19:59 +0000
(10:19 +0000)
committer
Pavel Shilovsky
<pshilov@microsoft.com>
Mon, 9 Nov 2020 23:16:50 +0000
(15:16 -0800)
mount.cifs.c
patch
|
blob
|
history
diff --git
a/mount.cifs.c
b/mount.cifs.c
index 5d43c00bd7bce5690bc2bc5885ec799fef54ab0c..81bdbc8a66f48aa1f2596cd42c1a9f31aeb53afc 100644
(file)
--- 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;
}