mirror of
https://github.com/systemd/systemd.git
synced 2025-01-05 13:18:06 +03:00
memfd-util: short memfd_clone_fd()
This commit is contained in:
parent
db5381c49c
commit
e1c52c9238
@ -200,17 +200,11 @@ int memfd_clone_fd(int fd, const char *name, int mode) {
|
|||||||
return r;
|
return r;
|
||||||
|
|
||||||
if (ro) {
|
if (ro) {
|
||||||
_cleanup_close_ int rfd = -EBADF;
|
|
||||||
|
|
||||||
r = memfd_set_sealed(mfd);
|
r = memfd_set_sealed(mfd);
|
||||||
if (r < 0)
|
if (r < 0)
|
||||||
return r;
|
return r;
|
||||||
|
|
||||||
rfd = fd_reopen(mfd, mode);
|
return fd_reopen(mfd, mode);
|
||||||
if (rfd < 0)
|
|
||||||
return rfd;
|
|
||||||
|
|
||||||
return TAKE_FD(rfd);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
off_t f = lseek(mfd, 0, SEEK_SET);
|
off_t f = lseek(mfd, 0, SEEK_SET);
|
||||||
|
Loading…
Reference in New Issue
Block a user