bug-hurd
[Top][All Lists]
Advanced

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

[PATCH] utils/mount: canonicalize mountpoints


From: Gabriele Giacone
Subject: [PATCH] utils/mount: canonicalize mountpoints
Date: Thu, 5 Jun 2014 00:34:45 +0200

* utils/mount.c (main): realpath mountpoint.
* utils/umount.c (do_umount): Likewise.
---
 utils/mount.c  | 7 +++++++
 utils/umount.c | 7 +++++++
 2 files changed, 14 insertions(+)

diff --git a/utils/mount.c b/utils/mount.c
index df77c66..c14e073 100644
--- a/utils/mount.c
+++ b/utils/mount.c
@@ -598,6 +598,13 @@ main (int argc, char **argv)
   if (err)
     error (3, ENOMEM, "collecting mount options");
 
+  if (mountpoint)
+    {
+      mountpoint = realpath (mountpoint, NULL);
+      if (! mountpoint)
+        error (3, errno, "Error while canonicalizing path");
+    }
+
   if (device)                  /* two-argument form */
     {
       struct mntent m =
diff --git a/utils/umount.c b/utils/umount.c
index 7901da6..4a568cd 100644
--- a/utils/umount.c
+++ b/utils/umount.c
@@ -192,6 +192,13 @@ do_umount (struct fs *fs)
 {
   error_t err = 0;
 
+  if (fs->mntent.mnt_dir)
+    {
+      fs->mntent.mnt_dir = realpath (fs->mntent.mnt_dir, NULL);
+      if (! fs->mntent.mnt_dir)
+        error (3, errno, "Error while canonicalizing path");
+    }
+
   file_t node = file_name_lookup (fs->mntent.mnt_dir, O_NOTRANS, 0666);
   if (node == MACH_PORT_NULL)
     {
-- 
2.0.0




reply via email to

[Prev in Thread] Current Thread [Next in Thread]