summaryrefslogtreecommitdiff
path: root/src/mount/mount-tool.c
diff options
context:
space:
mode:
authorYu Watanabe <watanabe.yu+github@gmail.com>2017-07-05 21:55:39 +0900
committerYu Watanabe <watanabe.yu+github@gmail.com>2017-07-05 21:55:39 +0900
commit3747daa2e531ba3ce8bab5f0459803db61113327 (patch)
tree1f6afcb0c6ae03c7fa76d4dcaf9668d4258948d7 /src/mount/mount-tool.c
parentf0aac575fc1063a43be421b2ce9776400ca02abd (diff)
downloadsystemd-3747daa2e531ba3ce8bab5f0459803db61113327.tar.gz
systemd-mount: support unmounting devices on remote host
The commit 9017f5d88d5061487de53f00a1a8c0a83e41e760 prohibits to unmount devices on remote host. This makes reenable such feature.
Diffstat (limited to 'src/mount/mount-tool.c')
-rw-r--r--src/mount/mount-tool.c26
1 files changed, 24 insertions, 2 deletions
diff --git a/src/mount/mount-tool.c b/src/mount/mount-tool.c
index 52b8ef5683..81c6ef5f74 100644
--- a/src/mount/mount-tool.c
+++ b/src/mount/mount-tool.c
@@ -311,8 +311,13 @@ static int parse_argv(int argc, char *argv[]) {
}
if (arg_transport != BUS_TRANSPORT_LOCAL) {
- log_error("Unmounting devices only supported locally.");
- return -EOPNOTSUPP;
+ int i;
+
+ for (i = optind; i < argc; i++)
+ if (!path_is_absolute(argv[i]) ) {
+ log_error("Only absolute path is supported: %s", argv[i]);
+ return -EINVAL;
+ }
}
} else {
if (optind >= argc) {
@@ -918,6 +923,23 @@ static int action_umount(
int i, r, r2 = 0;
+ if (arg_transport != BUS_TRANSPORT_LOCAL) {
+ for (i = optind; i < argc; i++) {
+ _cleanup_free_ char *p = NULL;
+
+ p = strdup(argv[i]);
+ if (!p)
+ return log_oom();
+
+ path_kill_slashes(p);
+
+ r = stop_mounts(bus, p);
+ if (r < 0)
+ r2 = r;
+ }
+ return r2;
+ }
+
for (i = optind; i < argc; i++) {
_cleanup_free_ char *u = NULL, *p = NULL;
struct stat st;