Fix for bug #4781: allow cleaning of /etc/mtab by canonicalizing mountpoint.
authorMichael Adam <obnox@samba.org>
Fri, 16 Nov 2007 21:26:26 +0000 (22:26 +0100)
committerMichael Adam <obnox@samba.org>
Fri, 16 Nov 2007 21:26:26 +0000 (22:26 +0100)
Canonicalize mountpoint by trimming trailing slashes before unmounting.
This allows for correct cleanup of /etc/mtab after unmounting.

Thanks to Steve Langasek <vorlon@debian.org>.

Michael
(This used to be commit 118fd6213d5f6419f654e9226a41d527c04346f7)

source3/client/umount.cifs.c

index d1195755ca1581584d3ef24d9e7c9180f7b25492..ab94a20c60c19abd62fb3f6d32dbda70fcd1e635 100644 (file)
@@ -341,6 +341,13 @@ int main(int argc, char ** argv)
 
        /* fixup path if needed */
 
+       /* Trim any trailing slashes */
+       while ((strlen(mountpoint) > 1) &&
+               (mountpoint[strlen(mountpoint)-1] == '/'))
+       {
+               mountpoint[strlen(mountpoint)-1] = '\0';
+       }
+
        /* make sure that this is a cifs filesystem */
        rc = statfs(mountpoint, &statbuf);