[PATCH 1/1] mount.nfs: strip of extra slashes in device name

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The kernel strips off extra '/' when the  device is entered
into /proc/mounts. So that umounts can this devices, strip off
any extra '/' before storing the device in the mtab.

Signed-off-by: Steve Dickson <steved@xxxxxxxxxx>
---
 utils/mount/mount.c |   18 ++++++++++++++++++
 1 files changed, 18 insertions(+), 0 deletions(-)

diff --git a/utils/mount/mount.c b/utils/mount/mount.c
index eea00af..eb63f50 100644
--- a/utils/mount/mount.c
+++ b/utils/mount/mount.c
@@ -485,6 +485,24 @@ int main(int argc, char *argv[])
 		goto out;
 	}
 	/*
+	 * The kernel strips off extra '/' when the device is entered 
+	 * into /proc/mounts. So that umounts can this devices, strip off
+	 * any extra '/' before storing the device in the mtab.
+	 */
+	if (strstr(spec, "//") != NULL) {
+		char *colen, *slash;
+
+		if ((colen = strchr(spec, ':'))) {
+			slash = (colen + 1);
+			while (*slash && *(slash+1) == '/')
+				slash++;
+			while (*slash)
+				*(++colen) = *(slash++);
+			*(colen+1) = '\0';
+		}
+	}
+
+	/*
 	 * Concatenate mount options from the configuration file
 	 */
 	mount_opts = mount_config_opts(spec, mount_point, mount_opts);
-- 
1.7.1

--
To unsubscribe from this list: send the line "unsubscribe linux-nfs" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Filesystem Development]     [Linux USB Development]     [Linux Media Development]     [Video for Linux]     [Linux NILFS]     [Linux Audio Users]     [Yosemite Info]     [Linux SCSI]

  Powered by Linux