mirror of
https://github.com/tmate-io/tmate.git
synced 2025-01-23 14:28:55 +01:00
Fix osdep_get_cwd on Solaris 11, from J Raynor.
This commit is contained in:
parent
5e7f1b9f0a
commit
24d9dc518d
@ -69,10 +69,19 @@ 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);
|
||||
|
Loading…
Reference in New Issue
Block a user