mirror of
https://github.com/systemd/systemd-stable.git
synced 2024-12-22 13:33:56 +03:00
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.
This commit is contained in:
parent
823e917f13
commit
6d88513e6b
@ -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);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user