From: Yu Watanabe Date: Thu, 30 Nov 2017 16:28:44 +0000 (+0900) Subject: mount: use chase_symlinks() X-Git-Tag: v236~70^2 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F7512%2Fhead;p=thirdparty%2Fsystemd.git mount: use chase_symlinks() --- 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]);