From ad2cc63412d563f31b33df3204bb2070cb12f320 Mon Sep 17 00:00:00 2001 From: Nicholas Marriott Date: Fri, 27 Jan 2012 09:01:06 +0000 Subject: [PATCH] Fill in osdep_get_cwd on Darwin, from Alex Ernst. --- osdep-darwin.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/osdep-darwin.c b/osdep-darwin.c index c5820df6..9cac1311 100644 --- a/osdep-darwin.c +++ b/osdep-darwin.c @@ -20,6 +20,7 @@ #include #include +#include #include #include #include @@ -52,6 +53,16 @@ osdep_get_name(int fd, unused char *tty) char * osdep_get_cwd(pid_t pid) { + static char wd[PATH_MAX]; + struct proc_vnodepathinfo pathinfo; + int ret; + + ret = proc_pidinfo( + pid, PROC_PIDVNODEPATHINFO, 0, &pathinfo, sizeof pathinfo); + if (ret == sizeof pathinfo) { + strlcpy(wd, pathinfo.pvi_cdir.vip_path, sizeof wd); + return (wd); + } return (NULL); }