aboutsummaryrefslogtreecommitdiff
path: root/osdep-openbsd.c
diff options
context:
space:
mode:
Diffstat (limited to 'osdep-openbsd.c')
-rw-r--r--osdep-openbsd.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/osdep-openbsd.c b/osdep-openbsd.c
index 4fb75bff..402b501c 100644
--- a/osdep-openbsd.c
+++ b/osdep-openbsd.c
@@ -137,10 +137,12 @@ error:
char*
osdep_get_cwd(pid_t pid)
{
- int name[] = { CTL_KERN, KERN_PROC_CWD, (int)pid };
+ int name[] = { CTL_KERN, KERN_PROC_CWD, 0 };
static char path[MAXPATHLEN];
size_t pathlen = sizeof path;
+ if ((name[2] = tcgetpgrp(fd)) == -1)
+ return (NULL);
if (sysctl(name, 3, path, &pathlen, NULL, 0) != 0)
return (NULL);
return (path);