about summary refs log tree commit diff
path: root/shared/systemd/src/basic/fd-util.h
diff options
context:
space:
mode:
authorMichael Biebl <biebl@debian.org>2020-10-05 22:28:16 +0200
committerMichael Biebl <biebl@debian.org>2020-10-05 22:28:16 +0200
commit47a2114d6f697a31d84c8874c49e94dd04119d75 (patch)
treee3022686ff1956d7f17f1f7cdf7022ce980b7a5c /shared/systemd/src/basic/fd-util.h
parent9d722f3d3492e31c0b3e4bcba603ffd65309c621 (diff)
parentaafc1dbe4712c86189bbc1d4d54ad8cb4c69be7e (diff)
Update upstream source from tag 'upstream/1.27.90'
Update to upstream version '1.27.90'
with Debian dir 72a0791efa5966be1724a82dfcac90f6cd22bd1b
Diffstat (limited to 'shared/systemd/src/basic/fd-util.h')
-rw-r--r--shared/systemd/src/basic/fd-util.h10
1 files changed, 10 insertions, 0 deletions
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);