]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
Open the DAHDI pseudo device and set it to be nonblocking atomically
authorMark Michelson <mmichelson@digium.com>
Mon, 16 Feb 2009 21:34:27 +0000 (21:34 +0000)
committerMark Michelson <mmichelson@digium.com>
Mon, 16 Feb 2009 21:34:27 +0000 (21:34 +0000)
Apparently on FreeBSD, attempting to set the O_NONBLOCKING flag separately
from opening the file was causing an "inappropriate ioctl for device" error.
While I cannot fathom why this would be happening, I certainly am not opposed
to making the code a bit more compact/efficient if it also fixes a bug.

(closes issue #14482)
Reported by: ys
Patches:
      meetme.patch uploaded by ys (license 281)
Tested by: ys

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@176249 65c4cc65-6c06-0410-ace0-fbb531ad65f3

apps/app_meetme.c

index a750728344616a4f167b610c7eeb1b0f2be7c8f2..dd9d0970bd4affd72fc467be75afd0526c609017 100644 (file)
@@ -1728,24 +1728,13 @@ static int conf_run(struct ast_channel *chan, struct ast_conference *conf, int c
  zapretry:
        origfd = chan->fds[0];
        if (retryzap) {
-               fd = open(DAHDI_FILE_PSEUDO, O_RDWR);
+               /* open pseudo in non-blocking mode */
+               fd = open(DAHDI_FILE_PSEUDO, O_RDWR | O_NONBLOCK);
                if (fd < 0) {
                        ast_log(LOG_WARNING, "Unable to open pseudo channel: %s\n", strerror(errno));
                        goto outrun;
                }
                using_pseudo = 1;
-               /* Make non-blocking */
-               flags = fcntl(fd, F_GETFL);
-               if (flags < 0) {
-                       ast_log(LOG_WARNING, "Unable to get flags: %s\n", strerror(errno));
-                       close(fd);
-                       goto outrun;
-               }
-               if (fcntl(fd, F_SETFL, flags | O_NONBLOCK)) {
-                       ast_log(LOG_WARNING, "Unable to set flags: %s\n", strerror(errno));
-                       close(fd);
-                       goto outrun;
-               }
                /* Setup buffering information */
                memset(&bi, 0, sizeof(bi));
                bi.bufsize = CONF_SIZE/2;