Bug#308106: new patch

Martin Jess Martin Jess <debian-bugs@fhloston.org>, 308106@bugs.debian.org
Fri, 20 May 2005 13:04:46 -0700


hi,

backported from chan_capi-0.4.0-pre1:

--- chan_capi.c 2004-08-13 12:07:28.000000000 +0200
+++ chan_capi.c.changed 2005-05-19 01:17:55.000000000 +0200
@@ -640,6 +639,7 @@
        char buffer[AST_MAX_EXTENSION];
        char called[AST_MAX_EXTENSION],calling[AST_MAX_EXTENSION];
        char bchaninfo[3];
+       long flags;

        _cmsg CMSG;
        MESSAGE_EXCHANGE_ERROR  error;
@@ -684,10 +684,14 @@
        if (pipe(fds) == 0) {
            ast_mutex_lock(&pipelock);
            i->fd = fds[0];
+           flags = fcntl(i->fd,F_GETFL);
+           fcntl(i->fd,F_SETFL,flags | O_SYNC | O_DIRECT);
            p = malloc(sizeof(struct capi_pipe));
            memset(p, 0, sizeof(struct capi_pipe));
            p->fd = fds[1];
-           c->fds[0] = fds[1];
+           flags = fcntl(i->fd,F_GETFL);
+           fcntl(p->fd,F_SETFL,flags | O_SYNC | O_DIRECT);
+           c->fds[0] = i->fd;
            p->PLCI = -1;
            p->i = i;
            p->c = c;

this has been tested to work on kernel 2.6.12-rc3 and 2.4.29.

hth

Martin Jess