summaryrefslogtreecommitdiff
path: root/src/portable
diff options
context:
space:
mode:
authorLuca Boccassi <luca.boccassi@microsoft.com>2020-06-23 15:56:33 +0100
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2020-06-25 18:40:19 +0200
commit6d88513e6b4fe36f59d3c5702a22ab796dea7852 (patch)
treea9b2bc5344dd6add6dd646e95ec7fb81c4d3de75 /src/portable
parent823e917f13ea813635b0f9f14e2cc8aabc6d6a75 (diff)
downloadsystemd-6d88513e6b4fe36f59d3c5702a22ab796dea7852.tar.gz
portabled: create temp file for unit, not directory
open_tmpfile_linkable is used to create a temporary file in the same directory as the target, but portabled uses the name of the parent directory instead of the file it intends to create. In other words, it creats a tmp for /etc/systemd/system.attached instead of /etc/systemd/system.attached/foo.service. It still works because it's later moved in the right place. But as a side effect, it tries the create the file in the parent directory which is /etc/systemd, and it case of read-only filesystems it fails.
Diffstat (limited to 'src/portable')
-rw-r--r--src/portable/portable.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/portable/portable.c b/src/portable/portable.c
index 3dc6d9e422..c7c11a48f2 100644
--- a/src/portable/portable.c
+++ b/src/portable/portable.c
@@ -877,7 +877,7 @@ static int attach_unit_file(
_cleanup_(unlink_and_freep) char *tmp = NULL;
_cleanup_close_ int fd = -1;
- fd = open_tmpfile_linkable(where, O_WRONLY|O_CLOEXEC, &tmp);
+ fd = open_tmpfile_linkable(path, O_WRONLY|O_CLOEXEC, &tmp);
if (fd < 0)
return log_debug_errno(fd, "Failed to create unit file '%s': %m", path);