summaryrefslogtreecommitdiff
path: root/codecs
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 /codecs
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 'codecs')
-rw-r--r--codecs/codec_dahdi.c7
1 files changed, 1 insertions, 6 deletions
diff --git a/codecs/codec_dahdi.c b/codecs/codec_dahdi.c
index efb016853..941bb1fb2 100644
--- a/codecs/codec_dahdi.c
+++ b/codecs/codec_dahdi.c
@@ -613,7 +613,6 @@ static int dahdi_translate(struct ast_trans_pvt *pvt, uint32_t dst_dahdi_fmt, ui
/* Request translation through zap if possible */
int fd;
struct codec_dahdi_pvt *dahdip = pvt->pvt;
- int flags;
int tried_once = 0;
const char *dev_filename = "/dev/dahdi/transcode";
@@ -659,11 +658,7 @@ retry:
return -1;
}
- flags = fcntl(fd, F_GETFL);
- if (flags > - 1) {
- if (fcntl(fd, F_SETFL, flags | O_NONBLOCK))
- ast_log(LOG_WARNING, "Could not set non-block mode!\n");
- }
+ ast_fd_set_flags(fd, O_NONBLOCK);
dahdip->fd = fd;