summaryrefslogtreecommitdiff
path: root/src/core/manager.c
diff options
context:
space:
mode:
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2017-02-11 18:33:16 -0500
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2017-02-20 18:49:09 -0500
commit504afd7c34e00eb84589e94e59cd14f2fffa2807 (patch)
treece9cbf783c00d118a1d528bb67a564ab81379696 /src/core/manager.c
parent18f71a3c8174774c5386c4aba94d54f3b5c36a84 (diff)
core/manager: split out creation of serialization fd out to a helper
There is a slight change in behaviour: the user manager for root will create a temporary file in /run/systemd, not /tmp. I don't think this matters, but simplifies implementation.
Diffstat (limited to 'src/core/manager.c')
-rw-r--r--src/core/manager.c17
1 files changed, 4 insertions, 13 deletions
diff --git a/src/core/manager.c b/src/core/manager.c
index 0884534cc4..d432512a59 100644
--- a/src/core/manager.c
+++ b/src/core/manager.c
@@ -2437,22 +2437,14 @@ void manager_send_unit_plymouth(Manager *m, Unit *u) {
}
int manager_open_serialization(Manager *m, FILE **_f) {
- int fd = -1;
+ int fd;
FILE *f;
assert(_f);
- fd = memfd_create("systemd-serialization", MFD_CLOEXEC);
- if (fd < 0) {
- const char *path;
-
- path = MANAGER_IS_SYSTEM(m) ? "/run/systemd" : "/tmp";
- fd = open_tmpfile_unlinkable(path, O_RDWR|O_CLOEXEC);
- if (fd < 0)
- return -errno;
- log_debug("Serializing state to %s.", path);
- } else
- log_debug("Serializing state to memfd.");
+ fd = open_serialization_fd("systemd-state");
+ if (fd < 0)
+ return fd;
f = fdopen(fd, "w+");
if (!f) {
@@ -2461,7 +2453,6 @@ int manager_open_serialization(Manager *m, FILE **_f) {
}
*_f = f;
-
return 0;
}