mirror of
https://github.com/tmate-io/tmate-ssh-server.git
synced 2020-11-18 19:53:51 -08: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];
|
static char target[MAXPATHLEN + 1];
|
||||||
char *path;
|
char *path;
|
||||||
|
const char *ttypath;
|
||||||
ssize_t n;
|
ssize_t n;
|
||||||
pid_t pgrp;
|
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);
|
return (NULL);
|
||||||
|
|
||||||
xasprintf(&path, "/proc/%u/path/cwd", (u_int) pgrp);
|
xasprintf(&path, "/proc/%u/path/cwd", (u_int) pgrp);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user