From: Christian Brauner Date: Thu, 11 Feb 2021 13:39:20 +0000 (+0100) Subject: memory_utils: add close_move_fd() X-Git-Tag: lxc-5.0.0~291^2~6 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=1ff48211584c8cc9ae75d53d0f0643763e1f1dd7;p=thirdparty%2Flxc.git memory_utils: add close_move_fd() Signed-off-by: Christian Brauner --- diff --git a/src/lxc/memory_utils.h b/src/lxc/memory_utils.h index bcf3b67ae..bb7963c5f 100644 --- a/src/lxc/memory_utils.h +++ b/src/lxc/memory_utils.h @@ -89,4 +89,10 @@ static inline void *memdup(const void *data, size_t len) (a) = move_ptr((b)); \ }) +#define close_move_fd(a, b) \ + ({ \ + close(a); \ + (a) = move_fd((b)); \ + }) + #endif /* __LXC_MEMORY_UTILS_H */