fd-util: make TAKE_FD free of double evaluation
Better be safe than sorry.
This commit is contained in:
+4
-3
@@ -91,9 +91,10 @@ static inline int make_null_stdio(void) {
|
||||
/* Like TAKE_PTR() but for file descriptors, resetting them to -1 */
|
||||
#define TAKE_FD(fd) \
|
||||
({ \
|
||||
int _fd_ = (fd); \
|
||||
(fd) = -1; \
|
||||
_fd_; \
|
||||
int *_fd_ = &(fd); \
|
||||
int _ret_ = *_fd_; \
|
||||
*_fd_ = -1; \
|
||||
_ret_; \
|
||||
})
|
||||
|
||||
/* Like free_and_replace(), but for file descriptors */
|
||||
|
||||
Reference in New Issue
Block a user