1
0
mirror of https://github.com/systemd/systemd.git synced 2024-12-31 21:18:09 +03:00

memfd-util: short memfd_clone_fd()

This commit is contained in:
Lennart Poettering 2024-12-13 18:55:59 +01:00
parent db5381c49c
commit e1c52c9238

View File

@ -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);