Canonicalize path before trying to unmount it.
authorMatt Kraai <kraai@debian.org>
Wed, 2 May 2001 21:24:51 +0000 (21:24 -0000)
committerMatt Kraai <kraai@debian.org>
Wed, 2 May 2001 21:24:51 +0000 (21:24 -0000)
umount.c
util-linux/umount.c

index 3e23b9705edf3e660f277fca16eadf945d496ded..0eade5a36363692797c0aa12e7ad0d5d091fa535 100644 (file)
--- a/umount.c
+++ b/umount.c
@@ -22,6 +22,7 @@
  *
  */
 
+#include <limits.h>
 #include <stdio.h>
 #include <mntent.h>
 #include <errno.h>
@@ -236,6 +237,8 @@ static int umount_all(void)
 
 extern int umount_main(int argc, char **argv)
 {
+       char path[PATH_MAX];
+
        if (argc < 2) {
                show_usage();
        }
@@ -282,7 +285,9 @@ extern int umount_main(int argc, char **argv)
                else
                        return EXIT_FAILURE;
        }
-       if (do_umount(*argv) == TRUE)
+       if (realpath(*argv, path) == NULL)
+               perror_msg_and_die("%s", path);
+       if (do_umount(path) == TRUE)
                return EXIT_SUCCESS;
        perror_msg_and_die("%s", *argv);
 }
index 3e23b9705edf3e660f277fca16eadf945d496ded..0eade5a36363692797c0aa12e7ad0d5d091fa535 100644 (file)
@@ -22,6 +22,7 @@
  *
  */
 
+#include <limits.h>
 #include <stdio.h>
 #include <mntent.h>
 #include <errno.h>
@@ -236,6 +237,8 @@ static int umount_all(void)
 
 extern int umount_main(int argc, char **argv)
 {
+       char path[PATH_MAX];
+
        if (argc < 2) {
                show_usage();
        }
@@ -282,7 +285,9 @@ extern int umount_main(int argc, char **argv)
                else
                        return EXIT_FAILURE;
        }
-       if (do_umount(*argv) == TRUE)
+       if (realpath(*argv, path) == NULL)
+               perror_msg_and_die("%s", path);
+       if (do_umount(path) == TRUE)
                return EXIT_SUCCESS;
        perror_msg_and_die("%s", *argv);
 }