From c6179991b8a548e5b1d70a92dc1f81df6af6bfe7 Mon Sep 17 00:00:00 2001 From: Mark Spencer Date: Mon, 28 Apr 2003 01:44:40 +0000 Subject: Make wilcalu non-blocking git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@922 65c4cc65-6c06-0410-ace0-fbb531ad65f3 --- pbx/pbx_wilcalu.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'pbx/pbx_wilcalu.c') diff --git a/pbx/pbx_wilcalu.c b/pbx/pbx_wilcalu.c index 134ce6bb6..c14e39526 100755 --- a/pbx/pbx_wilcalu.c +++ b/pbx/pbx_wilcalu.c @@ -58,7 +58,9 @@ static void *autodial(void *ignore) { pthread_t dialstring_thread; char * sendbufptr=sendbuf; - int fd=open(dialfile,O_RDONLY); + int fd=open(dialfile,O_RDONLY|O_NONBLOCK); + int flags = fcntl(fd, F_GETFL); + fcntl(fd, F_SETFL, flags & ~O_NONBLOCK); printf("Entered Wil-Calu fd=%d\n",fd); if(fd<0) { printf("Autodial: Unable to open file\n"); @@ -75,7 +77,7 @@ static void *autodial(void *ignore) bytes=read(fd,buf,256); buf[(int)bytes]=0; - if(bytes){ + if(bytes>0){ int x; printf("WilCalu : Read Buf %s\n",buf); sendbufptr=sendbuf; -- cgit v1.2.3