From ea97a10df5732dfcc931197a01d6446ed92b7658 Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Fri, 16 Nov 2007 22:26:26 +0100 Subject: [PATCH] Fix for bug #4781: allow cleaning of /etc/mtab by canonicalizing mountpoint. Canonicalize mountpoint by trimming trailing slashes before unmounting. This allows for correct cleanup of /etc/mtab after unmounting. Thanks to Steve Langasek . Michael --- source/client/umount.cifs.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/source/client/umount.cifs.c b/source/client/umount.cifs.c index 3869e3439fc..47ddd1e92ee 100644 --- a/source/client/umount.cifs.c +++ b/source/client/umount.cifs.c @@ -342,6 +342,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); -- 2.34.1