[Asterisk-bsd] app_dahdiscan.c: Unable to set flags: Inappropriate ioctl for device

michel michel at seliverstoff.fr
Sat Dec 5 18:03:32 CST 2009


 Hello, dahdiscan isn't working on my system (freebsd 7.2). It generates 
this error:
"app_dahdiscan.c: Unable to set flags: Inappropriate ioctl for device"
The reason seems to be the same as in bug 0014482 
https://issues.asterisk.org/view.php?id=14482
I made this litle patch and thought it may be useful to someone else.
Michel

--- apps/app_dahdiscan.orig     2008-12-19 14:48:00.000000000 -0500
+++ apps/app_dahdiscan.c        2009-12-04 10:41:27.000000000 -0500
@@ -135,23 +135,11 @@
  zapretry:
        origfd = chan->fds[0];
        if (retryzap) {
-               fd = open(DAHDI_FILE_PSEUDO, O_RDWR);
+               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;
                }
-               /* 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;




More information about the Asterisk-BSD mailing list