From 5bc9f949a4b1496aac0e9aeda675e041119ffa92 Mon Sep 17 00:00:00 2001 From: Yu Watanabe Date: Fri, 1 Dec 2017 01:28:44 +0900 Subject: [PATCH] mount: use chase_symlinks() --- src/mount/mount-tool.c | 19 ++++--------------- 1 file changed, 4 insertions(+), 15 deletions(-) diff --git a/src/mount/mount-tool.c b/src/mount/mount-tool.c index b454c455184..da3647e7e2f 100644 --- a/src/mount/mount-tool.c +++ b/src/mount/mount-tool.c @@ -334,19 +334,15 @@ static int parse_argv(int argc, char *argv[]) { return log_oom(); } else if (arg_transport == BUS_TRANSPORT_LOCAL) { - _cleanup_free_ char *u = NULL, *p = NULL; + _cleanup_free_ char *u = NULL; u = fstab_node_to_udev_node(argv[optind]); if (!u) return log_oom(); - r = path_make_absolute_cwd(u, &p); + r = chase_symlinks(u, NULL, 0, &arg_mount_what); if (r < 0) return log_error_errno(r, "Failed to make path %s absolute: %m", u); - - arg_mount_what = canonicalize_file_name(p); - if (!arg_mount_what) - return log_error_errno(errno, "Failed to canonicalize path %s: %m", p); } else { arg_mount_what = strdup(argv[optind]); if (!arg_mount_what) @@ -989,26 +985,19 @@ static int action_umount( } for (i = optind; i < argc; i++) { - _cleanup_free_ char *u = NULL, *a = NULL, *p = NULL; + _cleanup_free_ char *u = NULL, *p = NULL; struct stat st; u = fstab_node_to_udev_node(argv[i]); if (!u) return log_oom(); - r = path_make_absolute_cwd(u, &a); + r = chase_symlinks(u, NULL, 0, &p); if (r < 0) { r2 = log_error_errno(r, "Failed to make path %s absolute: %m", argv[i]); continue; } - p = canonicalize_file_name(a); - - if (!p) { - r2 = log_error_errno(errno, "Failed to canonicalize path %s: %m", argv[i]); - continue; - } - if (stat(p, &st) < 0) return log_error_errno(errno, "Can't stat %s (from %s): %m", p, argv[i]); -- 2.47.3