serialize: drop memfd fallback when serializing

This commit is contained in:
Lennart Poettering
2024-12-17 18:26:15 +01:00
parent e1c52c9238
commit 52cd287933
+4 -13
View File
@@ -547,21 +547,12 @@ void deserialize_ratelimit(RateLimit *rl, const char *name, const char *value) {
}
int open_serialization_fd(const char *ident) {
int fd;
fd = memfd_create_wrapper(ident, MFD_CLOEXEC | MFD_NOEXEC_SEAL);
if (fd < 0) {
const char *path;
path = getpid_cached() == 1 ? "/run/systemd" : "/tmp";
fd = open_tmpfile_unlinkable(path, O_RDWR|O_CLOEXEC);
if (fd < 0)
return fd;
log_debug("Serializing %s to %s.", ident, path);
} else
log_debug("Serializing %s to memfd.", ident);
int fd = memfd_create_wrapper(ident, MFD_CLOEXEC | MFD_NOEXEC_SEAL);
if (fd < 0)
return fd;
log_debug("Serializing %s to memfd.", ident);
return fd;
}