aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatt Kraai <kraai@debian.org>2001-05-02 21:24:51 +0000
committerMatt Kraai <kraai@debian.org>2001-05-02 21:24:51 +0000
commitadcbc12d85b91929b73f3897bff7d1559aa39c51 (patch)
tree71609bf6a64df11bf0456542e14ca426772d5ce5
parent3425111bb9925b9a00c34cbe95639a6e0bce58c1 (diff)
downloadbusybox-w32-adcbc12d85b91929b73f3897bff7d1559aa39c51.tar.gz
busybox-w32-adcbc12d85b91929b73f3897bff7d1559aa39c51.tar.bz2
busybox-w32-adcbc12d85b91929b73f3897bff7d1559aa39c51.zip
Canonicalize path before trying to unmount it.
-rw-r--r--umount.c7
-rw-r--r--util-linux/umount.c7
2 files changed, 12 insertions, 2 deletions
diff --git a/umount.c b/umount.c
index 3e23b9705..0eade5a36 100644
--- a/umount.c
+++ b/umount.c
@@ -22,6 +22,7 @@
22 * 22 *
23 */ 23 */
24 24
25#include <limits.h>
25#include <stdio.h> 26#include <stdio.h>
26#include <mntent.h> 27#include <mntent.h>
27#include <errno.h> 28#include <errno.h>
@@ -236,6 +237,8 @@ static int umount_all(void)
236 237
237extern int umount_main(int argc, char **argv) 238extern int umount_main(int argc, char **argv)
238{ 239{
240 char path[PATH_MAX];
241
239 if (argc < 2) { 242 if (argc < 2) {
240 show_usage(); 243 show_usage();
241 } 244 }
@@ -282,7 +285,9 @@ extern int umount_main(int argc, char **argv)
282 else 285 else
283 return EXIT_FAILURE; 286 return EXIT_FAILURE;
284 } 287 }
285 if (do_umount(*argv) == TRUE) 288 if (realpath(*argv, path) == NULL)
289 perror_msg_and_die("%s", path);
290 if (do_umount(path) == TRUE)
286 return EXIT_SUCCESS; 291 return EXIT_SUCCESS;
287 perror_msg_and_die("%s", *argv); 292 perror_msg_and_die("%s", *argv);
288} 293}
diff --git a/util-linux/umount.c b/util-linux/umount.c
index 3e23b9705..0eade5a36 100644
--- a/util-linux/umount.c
+++ b/util-linux/umount.c
@@ -22,6 +22,7 @@
22 * 22 *
23 */ 23 */
24 24
25#include <limits.h>
25#include <stdio.h> 26#include <stdio.h>
26#include <mntent.h> 27#include <mntent.h>
27#include <errno.h> 28#include <errno.h>
@@ -236,6 +237,8 @@ static int umount_all(void)
236 237
237extern int umount_main(int argc, char **argv) 238extern int umount_main(int argc, char **argv)
238{ 239{
240 char path[PATH_MAX];
241
239 if (argc < 2) { 242 if (argc < 2) {
240 show_usage(); 243 show_usage();
241 } 244 }
@@ -282,7 +285,9 @@ extern int umount_main(int argc, char **argv)
282 else 285 else
283 return EXIT_FAILURE; 286 return EXIT_FAILURE;
284 } 287 }
285 if (do_umount(*argv) == TRUE) 288 if (realpath(*argv, path) == NULL)
289 perror_msg_and_die("%s", path);
290 if (do_umount(path) == TRUE)
286 return EXIT_SUCCESS; 291 return EXIT_SUCCESS;
287 perror_msg_and_die("%s", *argv); 292 perror_msg_and_die("%s", *argv);
288} 293}