summaryrefslogtreecommitdiff
path: root/util-linux/umount.c
diff options
context:
space:
mode:
authorMatt Kraai2001-05-02 21:24:51 +0000
committerMatt Kraai2001-05-02 21:24:51 +0000
commitadcbc12d85b91929b73f3897bff7d1559aa39c51 (patch)
tree71609bf6a64df11bf0456542e14ca426772d5ce5 /util-linux/umount.c
parent3425111bb9925b9a00c34cbe95639a6e0bce58c1 (diff)
downloadbusybox-adcbc12d85b91929b73f3897bff7d1559aa39c51.zip
busybox-adcbc12d85b91929b73f3897bff7d1559aa39c51.tar.gz
Canonicalize path before trying to unmount it.
Diffstat (limited to 'util-linux/umount.c')
-rw-r--r--util-linux/umount.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/util-linux/umount.c b/util-linux/umount.c
index 3e23b97..0eade5a 100644
--- a/util-linux/umount.c
+++ b/util-linux/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);
}