Canonicalize path before trying to unmount it.
This commit is contained in:
parent
3425111bb9
commit
adcbc12d85
7
umount.c
7
umount.c
@ -22,6 +22,7 @@
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include <limits.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <mntent.h>
|
#include <mntent.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
@ -236,6 +237,8 @@ static int umount_all(void)
|
|||||||
|
|
||||||
extern int umount_main(int argc, char **argv)
|
extern int umount_main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
|
char path[PATH_MAX];
|
||||||
|
|
||||||
if (argc < 2) {
|
if (argc < 2) {
|
||||||
show_usage();
|
show_usage();
|
||||||
}
|
}
|
||||||
@ -282,7 +285,9 @@ extern int umount_main(int argc, char **argv)
|
|||||||
else
|
else
|
||||||
return EXIT_FAILURE;
|
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;
|
return EXIT_SUCCESS;
|
||||||
perror_msg_and_die("%s", *argv);
|
perror_msg_and_die("%s", *argv);
|
||||||
}
|
}
|
||||||
|
@ -22,6 +22,7 @@
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include <limits.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <mntent.h>
|
#include <mntent.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
@ -236,6 +237,8 @@ static int umount_all(void)
|
|||||||
|
|
||||||
extern int umount_main(int argc, char **argv)
|
extern int umount_main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
|
char path[PATH_MAX];
|
||||||
|
|
||||||
if (argc < 2) {
|
if (argc < 2) {
|
||||||
show_usage();
|
show_usage();
|
||||||
}
|
}
|
||||||
@ -282,7 +285,9 @@ extern int umount_main(int argc, char **argv)
|
|||||||
else
|
else
|
||||||
return EXIT_FAILURE;
|
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;
|
return EXIT_SUCCESS;
|
||||||
perror_msg_and_die("%s", *argv);
|
perror_msg_and_die("%s", *argv);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user