summaryrefslogtreecommitdiff
path: root/main/udptl.c
diff options
context:
space:
mode:
authorSean Bright <sean.bright@gmail.com>2017-12-07 10:52:39 -0500
committerSean Bright <sean.bright@gmail.com>2017-12-08 13:27:42 -0600
commitf9c6f692053ac865d46cbf8843ab810dc66cba67 (patch)
tree60bfe167eee2d096abe839803fdd4e4691f6c562 /main/udptl.c
parent52de5a05f0f6bf534c0642a4f43daa562b5b9004 (diff)
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
Diffstat (limited to 'main/udptl.c')
-rw-r--r--main/udptl.c4
1 files changed, 1 insertions, 3 deletions
diff --git a/main/udptl.c b/main/udptl.c
index 853e43c44..d982f6bcb 100644
--- a/main/udptl.c
+++ b/main/udptl.c
@@ -1012,7 +1012,6 @@ struct ast_udptl *ast_udptl_new_with_bindaddr(struct ast_sched_context *sched, s
int x;
int startplace;
int i;
- long int flags;
RAII_VAR(struct udptl_config *, cfg, ao2_global_obj_ref(globals), ao2_cleanup);
if (!cfg || !cfg->general) {
@@ -1043,8 +1042,7 @@ struct ast_udptl *ast_udptl_new_with_bindaddr(struct ast_sched_context *sched, s
ast_log(LOG_WARNING, "Unable to allocate socket: %s\n", strerror(errno));
return NULL;
}
- flags = fcntl(udptl->fd, F_GETFL);
- fcntl(udptl->fd, F_SETFL, flags | O_NONBLOCK);
+ ast_fd_set_flags(udptl->fd, O_NONBLOCK);
#ifdef SO_NO_CHECK
if (cfg->general->nochecksums)