Applied with some trivial style nits, check it still builds please :-).

Thanks!


On Mon, Sep 22, 2014 at 01:07:16AM -0500, J Raynor wrote:
> > I think you should probably loop for EINTR from read() but otherwise
> > this looks fine to me.
> 
> I've attached an updated patch.

> diff --git a/compat/forkpty-aix.c b/compat/forkpty-aix.c
> index db9c2e7..98119f0 100644
> --- a/compat/forkpty-aix.c
> +++ b/compat/forkpty-aix.c
> @@ -23,16 +23,20 @@
>  #include <stdlib.h>
>  #include <stropts.h>
>  #include <unistd.h>
> +#include <errno.h>
>  
>  #include "tmux.h"
>  
>  pid_t
>  forkpty(int *master, unused char *name, struct termios *tio, struct winsize 
> *ws)
>  {
> -     int     slave, fd;
> -     char   *path;
> +     int     slave, fd, pipe_fd[2];
> +     char   *path, dummy_buf;
>       pid_t   pid;
>  
> +     if (pipe(pipe_fd) == -1)
> +             return (-1);
> +
>       if ((*master = open("/dev/ptc", O_RDWR|O_NOCTTY)) == -1)
>               return (-1);
>  
> @@ -46,6 +50,13 @@ forkpty(int *master, unused char *name, struct termios 
> *tio, struct winsize *ws)
>               goto out;
>       case 0:
>               close(*master);
> +             close(pipe_fd[1]);
> +
> +             while(read(pipe_fd[0], &dummy_buf, 1) == -1)
> +                     if (errno != EINTR)
> +                             break;
> +
> +             close(pipe_fd[0]);
>  
>               fd = open(_PATH_TTY, O_RDWR|O_NOCTTY);
>               if (fd >= 0) {
> @@ -80,13 +91,18 @@ forkpty(int *master, unused char *name, struct termios 
> *tio, struct winsize *ws)
>               dup2(slave, 2);
>               if (slave > 2)
>                       close(slave);
> +
>               return (0);
>       }
>  
>       close(slave);
> +     close(pipe_fd[0]);
> +     close(pipe_fd[1]);
>       return (pid);
>  
>  out:
> +     close(pipe_fd[0]);
> +     close(pipe_fd[1]);
>       if (*master != -1)
>               close(*master);
>       if (slave != -1)


------------------------------------------------------------------------------
Meet PCI DSS 3.0 Compliance Requirements with EventLog Analyzer
Achieve PCI DSS 3.0 Compliant Status with Out-of-the-box PCI DSS Reports
Are you Audit-Ready for PCI DSS 3.0 Compliance? Download White paper
Comply to PCI DSS 3.0 Requirement 10 and 11.5 with EventLog Analyzer
http://pubads.g.doubleclick.net/gampad/clk?id=154622311&iu=/4140/ostg.clktrk
_______________________________________________
tmux-users mailing list
tmux-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/tmux-users

Reply via email to