summaryrefslogtreecommitdiff
path: root/apps
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 14:27:50 -0500
commitf726f119740373a01bef6e26e5c1f02dd277033f (patch)
treec86e6167c79cf6289258f423ec16341932ed9e69 /apps
parent54a86779a3d1cc2a1c859d76180f155865713bb5 (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 'apps')
-rw-r--r--apps/app_ices.c4
1 files changed, 1 insertions, 3 deletions
diff --git a/apps/app_ices.c b/apps/app_ices.c
index d0fdf5cf1..a043d3de4 100644
--- a/apps/app_ices.c
+++ b/apps/app_ices.c
@@ -115,7 +115,6 @@ static int ices_exec(struct ast_channel *chan, const char *data)
int fds[2];
int ms = -1;
int pid = -1;
- int flags;
struct ast_format *oreadformat;
struct ast_frame *f;
char filename[256]="";
@@ -130,8 +129,7 @@ static int ices_exec(struct ast_channel *chan, const char *data)
ast_log(LOG_WARNING, "Unable to create pipe\n");
return -1;
}
- flags = fcntl(fds[1], F_GETFL);
- fcntl(fds[1], F_SETFL, flags | O_NONBLOCK);
+ ast_fd_set_flags(fds[1], O_NONBLOCK);
ast_stopstream(chan);