mirror of
https://github.com/asterisk/asterisk.git
synced 2025-10-12 15:45:18 +00:00
utils: Add convenience function for setting fd flags
There are many places in the code base where we ignore the return value of fcntl() when getting/setting file descriptior flags. This patch introduces a convenience function that allows setting or clearing file descriptor flags and will also log an error on failure for later analysis. Change-Id: I8b81901e1b1bd537ca632567cdb408931c6eded7
This commit is contained in:
@@ -132,9 +132,7 @@ static void *pthread_timer_open(void)
|
||||
}
|
||||
|
||||
for (i = 0; i < ARRAY_LEN(timer->pipe); ++i) {
|
||||
int flags = fcntl(timer->pipe[i], F_GETFL);
|
||||
flags |= O_NONBLOCK;
|
||||
fcntl(timer->pipe[i], F_SETFL, flags);
|
||||
ast_fd_set_flags(timer->pipe[i], O_NONBLOCK);
|
||||
}
|
||||
|
||||
ao2_lock(pthread_timers);
|
||||
|
Reference in New Issue
Block a user