mirror of
https://github.com/systemd/systemd.git
synced 2026-08-03 06:30:30 +00:00
fd-util: add ASSERT_FD() that is similar to ASSERT_PTR() but for fds
This commit is contained in:
@@ -121,3 +121,11 @@ static inline char *format_proc_fd_path(char buf[static PROC_FD_PATH_MAX], int f
|
||||
format_proc_fd_path((char[PROC_FD_PATH_MAX]) {}, (fd))
|
||||
|
||||
const char *accmode_to_string(int flags);
|
||||
|
||||
/* Like ASSERT_PTR, but for fds */
|
||||
#define ASSERT_FD(fd) \
|
||||
({ \
|
||||
int _fd_ = (fd); \
|
||||
assert(_fd_ >= 0); \
|
||||
_fd_; \
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user