Applied this, we'll see if anyone complains it breaks older Solaris and
if it does think again. Cheers


On Sat, Aug 30, 2014 at 06:00:44PM -0500, J Raynor wrote:
> pane_current_path on solaris doesn't work.  I only have access to
> solaris 11, so I can't tell if this is a new problem with that version
> or if it hasn't worked for a while.
> 
> I've attached a patch that fixes the problem, but I can't test on
> previous versions of solaris.
> 
> In osdep-sunos.c, osdep_get_cwd calls tcgetpgrp to get the pgrp.
> tcgetpgrp fails because (on solaris) the caller has to be in the
> foreground process group of the terminal it's querying.  The TIOCGPGRP
> ioctl doesn't have this restriction.  But it needs the slave side of
> the pty, and the fd passed in is the master side.  This can be worked
> around with ptsname.

> diff --git a/osdep-sunos.c b/osdep-sunos.c
> index fd644f5..f132f4d 100644
> --- a/osdep-sunos.c
> +++ b/osdep-sunos.c
> @@ -69,10 +69,21 @@ osdep_get_cwd(int fd)
>  {
>       static char      target[MAXPATHLEN + 1];
>       char            *path;
> +     const char      *ttypath;
>       ssize_t          n;
>       pid_t            pgrp;
> +     int              retval, ttyfd;
>  
> -     if ((pgrp = tcgetpgrp(fd)) == -1)
> +     if ((ttypath = ptsname(fd)) == NULL)
> +             return (NULL);
> +
> +     if ((ttyfd = open(ttypath, O_RDONLY|O_NOCTTY)) == -1)
> +             return (NULL);
> +
> +     retval = ioctl(ttyfd, TIOCGPGRP, &pgrp);
> +     close(ttyfd);
> +
> +     if (retval == -1)
>               return (NULL);
>  
>       xasprintf(&path, "/proc/%u/path/cwd", (u_int) pgrp);

> ------------------------------------------------------------------------------
> Slashdot TV.  
> Video for Nerds.  Stuff that matters.
> http://tv.slashdot.org/

> _______________________________________________
> tmux-users mailing list
> tmux-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/tmux-users


------------------------------------------------------------------------------
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