Last active
October 6, 2016 10:09
-
-
Save aki017/f885a4e00d48f6278c03c754523fdc83 to your computer and use it in GitHub Desktop.
tmux2.3 WSL(Bash on Windows, Windows Subsystem for Linux) patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- osdep-linux.c 2016-01-21 09:00:28.000000000 +0900 | |
+++ osdep-linux.c 2016-10-06 18:58:31.307743300 +0900 | |
@@ -21,6 +21,7 @@ | |
#include <sys/param.h> | |
#include <event.h> | |
+#include <fcntl.h> | |
#include <stdio.h> | |
#include <stdlib.h> | |
#include <unistd.h> | |
@@ -66,10 +67,16 @@ osdep_get_cwd(int fd) | |
{ | |
static char target[MAXPATHLEN + 1]; | |
char *path; | |
+ const char *ttypath; | |
pid_t pgrp, sid; | |
+ int ttyfd; | |
ssize_t n; | |
+ if ((ttypath = ptsname(fd)) == NULL) | |
+ return (NULL); | |
+ if ((ttyfd = open(ttypath, O_RDONLY|O_NOCTTY)) == -1) | |
+ return (NULL); | |
- if ((pgrp = tcgetpgrp(fd)) == -1) | |
+ if ((pgrp = tcgetpgrp(ttyfd)) == -1) | |
return (NULL); | |
xasprintf(&path, "/proc/%lld/cwd", (long long) pgrp); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment