[asterisk-commits] mmichelson: branch 1.4 r176249 - /branches/1.4/apps/app_meetme.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Mon Feb 16 15:34:28 CST 2009


Author: mmichelson
Date: Mon Feb 16 15:34:27 2009
New Revision: 176249

URL: http://svn.digium.com/svn-view/asterisk?view=rev&rev=176249
Log:
Open the DAHDI pseudo device and set it to be nonblocking atomically

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


Modified:
    branches/1.4/apps/app_meetme.c

Modified: branches/1.4/apps/app_meetme.c
URL: http://svn.digium.com/svn-view/asterisk/branches/1.4/apps/app_meetme.c?view=diff&rev=176249&r1=176248&r2=176249
==============================================================================
--- branches/1.4/apps/app_meetme.c (original)
+++ branches/1.4/apps/app_meetme.c Mon Feb 16 15:34:27 2009
@@ -1728,24 +1728,13 @@
  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;




More information about the asterisk-commits mailing list