From aafc1dbe4712c86189bbc1d4d54ad8cb4c69be7e Mon Sep 17 00:00:00 2001 From: Michael Biebl Date: Mon, 5 Oct 2020 22:27:18 +0200 Subject: New upstream version 1.27.90 --- shared/systemd/src/basic/fd-util.h | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'shared/systemd/src/basic/fd-util.h') diff --git a/shared/systemd/src/basic/fd-util.h b/shared/systemd/src/basic/fd-util.h index e490753c..93ce95cd 100644 --- a/shared/systemd/src/basic/fd-util.h +++ b/shared/systemd/src/basic/fd-util.h @@ -93,6 +93,16 @@ static inline int make_null_stdio(void) { _fd_; \ }) +/* Like free_and_replace(), but for file descriptors */ +#define CLOSE_AND_REPLACE(a, b) \ + ({ \ + int *_fdp_ = &(a); \ + safe_close(*_fdp_); \ + *_fdp_ = TAKE_FD(b); \ + 0; \ + }) + + int fd_reopen(int fd, int flags); int read_nr_open(void); -- cgit 1.3.0-6-gf8a5