On 7/26/24 19:27, Jakub Sitnicki wrote:
On Wed, Jul 24, 2024 at 01:32 PM +02, Michal Luczaj wrote:
+#define take_fd(fd) \
- ({ \
__auto_type __val = (fd); \
fd = -EBADF; \
__val; \
- })
Probably should operate on a pointer to fd to avoid side effects, like __get_and_null macro in include/linux/cleanup.h. take_fd is effectively __get_and_null(fd, -EBADFD). [...]
OK, I'll just make use of stuff from cleanup.h.