summaryrefslogtreecommitdiffstats
path: root/src/shared/data-fd-util.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2024-12-13 18:55:59 +0100
committerLennart Poettering <lennart@poettering.net>2024-12-17 18:26:15 +0100
commite1c52c9238718347a2b74a0f9abaf76cdd36902f (patch)
treed0e4a9fe8b75903fe7410caf1fbe20357c4b7d57 /src/shared/data-fd-util.c
parentmemfd-util: simplify memfd_new_and_seal() (diff)
downloadsystemd-e1c52c9238718347a2b74a0f9abaf76cdd36902f.tar.xz
systemd-e1c52c9238718347a2b74a0f9abaf76cdd36902f.zip
memfd-util: short memfd_clone_fd()
Diffstat (limited to '')
-rw-r--r--src/shared/data-fd-util.c8
1 files changed, 1 insertions, 7 deletions
diff --git a/src/shared/data-fd-util.c b/src/shared/data-fd-util.c
index b948ab6cc4..4ef4100564 100644
--- a/src/shared/data-fd-util.c
+++ b/src/shared/data-fd-util.c
@@ -200,17 +200,11 @@ int memfd_clone_fd(int fd, const char *name, int mode) {
return r;
if (ro) {
- _cleanup_close_ int rfd = -EBADF;
-
r = memfd_set_sealed(mfd);
if (r < 0)
return r;
- rfd = fd_reopen(mfd, mode);
- if (rfd < 0)
- return rfd;
-
- return TAKE_FD(rfd);
+ return fd_reopen(mfd, mode);
}
off_t f = lseek(mfd, 0, SEEK_SET);