mirror of
https://github.com/tmux/tmux.git
synced 2025-09-01 20:57:00 +00:00
Use pgrp of pty fd not pid of immediate child when recovering current working
directory (like current process). From Marcel Partap.
This commit is contained in:
@ -65,13 +65,17 @@ osdep_get_name(int fd, char *tty)
|
||||
}
|
||||
|
||||
char *
|
||||
osdep_get_cwd(pid_t pid)
|
||||
osdep_get_cwd(int fd)
|
||||
{
|
||||
static char target[MAXPATHLEN + 1];
|
||||
char *path;
|
||||
ssize_t n;
|
||||
pid_t pgrp;
|
||||
|
||||
xasprintf(&path, "/proc/%u/path/cwd", (u_int) pid);
|
||||
if ((pgrp = tcgetpgrp(fd)) == -1)
|
||||
return (NULL);
|
||||
|
||||
xasprintf(&path, "/proc/%u/path/cwd", (u_int) pgrp);
|
||||
n = readlink(path, target, MAXPATHLEN);
|
||||
free(path);
|
||||
if (n > 0) {
|
||||
|
Reference in New Issue
Block a user