summaryrefslogtreecommitdiffstats
path: root/src/basic/fd-util.h
diff options
context:
space:
mode:
authorDan Streetman <ddstreet@ieee.org>2022-12-06 19:07:34 +0100
committerLuca Boccassi <luca.boccassi@gmail.com>2023-01-24 19:33:43 +0100
commit40c5cc2b214fd47ebfe85786a2a220bd3e9f275a (patch)
tree07764acbdd87dde4091a4e1abc820c030c159a5b /src/basic/fd-util.h
parentman: clarify that MESSAGE= should not appear more than once in the same journ... (diff)
downloadsystemd-40c5cc2b214fd47ebfe85786a2a220bd3e9f275a.tar.xz
systemd-40c5cc2b214fd47ebfe85786a2a220bd3e9f275a.zip
Consolidate various TAKE_* into TAKE_GENERIC(), add TAKE_STRUCT()
Diffstat (limited to 'src/basic/fd-util.h')
-rw-r--r--src/basic/fd-util.h10
1 files changed, 2 insertions, 8 deletions
diff --git a/src/basic/fd-util.h b/src/basic/fd-util.h
index 97339254ba..952afdd64f 100644
--- a/src/basic/fd-util.h
+++ b/src/basic/fd-util.h
@@ -90,14 +90,8 @@ static inline int make_null_stdio(void) {
return rearrange_stdio(-EBADF, -EBADF, -EBADF);
}
-/* Like TAKE_PTR() but for file descriptors, resetting them to -1 */
-#define TAKE_FD(fd) \
- ({ \
- int *_fd_ = &(fd); \
- int _ret_ = *_fd_; \
- *_fd_ = -EBADF; \
- _ret_; \
- })
+/* Like TAKE_PTR() but for file descriptors, resetting them to -EBADF */
+#define TAKE_FD(fd) TAKE_GENERIC(fd, int, -EBADF)
/* Like free_and_replace(), but for file descriptors */
#define close_and_replace(a, b) \