+static int parse_where(const char *input, char **ret_where) {
+ _cleanup_free_ char *where = NULL;
+ int r;
+
+ assert(input);
+ assert(ret_where);
+
+ if (arg_transport == BUS_TRANSPORT_LOCAL) {
+ r = chase(input, NULL, CHASE_NONEXISTENT, &where, NULL);
+ if (r < 0)
+ return log_error_errno(r, "Failed to make path %s absolute: %m", input);
+ } else {
+ where = strdup(input);
+ if (!where)
+ return log_oom();
+
+ path_simplify(where);
+
+ if (!path_is_absolute(where))
+ return log_error_errno(SYNTHETIC_ERRNO(EINVAL),
+ "Path must be absolute when operating remotely: %s",
+ where);
+ }
+
+ *ret_where = TAKE_PTR(where);
+ return 0;
+}
+