From 24d9dc518de6761f645165d49f321b2b56904fb5 Mon Sep 17 00:00:00 2001 From: Nicholas Marriott Date: Thu, 2 Oct 2014 09:25:15 +0100 Subject: [PATCH 1/2] Fix osdep_get_cwd on Solaris 11, from J Raynor. --- osdep-sunos.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/osdep-sunos.c b/osdep-sunos.c index fd644f5d..d071694e 100644 --- a/osdep-sunos.c +++ b/osdep-sunos.c @@ -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); From b6aef2490f086f3404f439308bb1746ec5134e9a Mon Sep 17 00:00:00 2001 From: Nicholas Marriott Date: Thu, 2 Oct 2014 09:47:00 +0100 Subject: [PATCH 2/2] Ignore ENXIO on Solaris as well, from Peter Schow. --- server-client.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server-client.c b/server-client.c index 08085f75..d1e3e829 100644 --- a/server-client.c +++ b/server-client.c @@ -549,7 +549,7 @@ server_client_check_resize(struct window_pane *wp) * other platforms and ignoring it doesn't seem to cause any * issues. */ - if (errno != EINVAL) + if (errno != EINVAL && errno != ENXIO) #endif fatal("ioctl failed"); }