Ticket #2949: PIPE2.patch

File PIPE2.patch, 3.1 KB (added by pavlinux, 11 years ago)
  • lib/utilunix.c

    diff --git a/lib/utilunix.c b/lib/utilunix.c
    index c3c6704..4f53d6e 100644
    a b tilde_expand (const char *directory) 
    340340void 
    341341open_error_pipe (void) 
    342342{ 
    343     if (pipe (error_pipe) < 0) 
     343    if (mc_pipe(error_pipe) < 0) 
    344344    { 
    345345        message (D_NORMAL, _("Warning"), _("Pipe failed")); 
    346346    } 
  • src/background.c

    diff --git a/src/background.c b/src/background.c
    index a68fe86..a628b90 100644
    a b do_background (struct FileOpContext *ctx, char *info) 
    514514    int back_comm[2];           /* back connection */ 
    515515    pid_t pid; 
    516516 
    517     if (pipe (comm) == -1) 
     517    if (mc_pipe(comm) == -1) 
    518518        return -1; 
    519519 
    520     if (pipe (back_comm) == -1) 
     520    if (mc_pipe(back_comm) == -1) 
    521521        return -1; 
    522522 
    523523    pid = fork (); 
  • src/cons.handler.c

    diff --git a/src/cons.handler.c b/src/cons.handler.c
    index 610db28..c2bea27 100644
    a b handle_console_linux (console_action_t action) 
    148148        status = close (pipefd1[1]); 
    149149        status = close (pipefd2[0]); 
    150150        /* Create two pipes for communication */ 
    151         if (!((pipe (pipefd1) == 0) && ((pipe (pipefd2)) == 0))) 
     151        if (!((mc_pipe(pipefd1) == 0) && ((mc_pipe(pipefd2)) == 0))) 
    152152        { 
    153153            mc_global.tty.console_flag = '\0'; 
    154154            break; 
  • src/subshell.c

    diff --git a/src/subshell.c b/src/subshell.c
    index 510cf4d..00ca85c 100644
    a b init_subshell (void) 
    850850                return; 
    851851            } 
    852852        } 
    853         else /* subshell_type is BASH or ZSH */ if (pipe (subshell_pipe)) 
     853        else /* subshell_type is BASH or ZSH */ if (mc_pipe(subshell_pipe)) 
    854854        { 
    855855            perror (__FILE__ ": couldn't create pipe"); 
    856856            mc_global.tty.use_subshell = FALSE; 
  • src/vfs/fish/fish.c

    diff --git a/src/vfs/fish/fish.c b/src/vfs/fish/fish.c
    index 5c84175..b1d2a4c 100644
    a b fish_pipeopen (struct vfs_s_super *super, const char *path, const char *argv[]) 
    312312    int fileset1[2], fileset2[2]; 
    313313    int res; 
    314314 
    315     if ((pipe (fileset1) < 0) || (pipe (fileset2) < 0)) 
     315    if ((mc_pipe(fileset1) < 0) || (mc_pipe(fileset2) < 0)) 
    316316        vfs_die ("Cannot pipe(): %m."); 
    317317 
    318318    res = fork (); 
  • lib/global.h

    diff --git a/lib/global.h b/lib/global.h
    index f13dfc0..0655c1e 100644
    a b typedef struct 
    269269        gboolean alternate_plus_minus; 
    270270 
    271271        /* Set if the window has changed it's size */ 
    272         SIG_ATOMIC_VOLATILE_T winch_flag; 
     272        volatile sig_atomic_t winch_flag; 
    273273    } tty; 
    274274 
    275275    struct 
    typedef struct 
    283283    } vfs; 
    284284} mc_global_t; 
    285285 
     286#if defined(linux) /* compiler definition */ 
     287  #include <linux/version.h>  
     288     #if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,28)                
     289          #define mc_pipe(fd)  pipe2(fd, O_DIRECT)                         
     290     #else    
     291          #define mc_pipe(fd) pipe(fd)                         
     292     #endif 
     293#else 
     294     #define mc_pipe(fd) pipe(fd) 
     295#endif 
     296 
    286297/*** global variables defined in .c file *********************************************************/ 
    287298 
    288299extern mc_global_t mc_global;