This is possible useful in nstool info and has further uses for nstool exec. Signed-off-by: David Gibson <david(a)gibson.dropbear.id.au> --- test/nstool.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/test/nstool.c b/test/nstool.c index 3ecc456..c07eabb 100644 --- a/test/nstool.c +++ b/test/nstool.c @@ -67,6 +67,7 @@ struct holder_info { pid_t pid; uid_t uid; gid_t gid; + char cwd[PATH_MAX]; }; static void usage(void) @@ -171,6 +172,8 @@ static void cmd_hold(int argc, char *argv[]) info.pid = getpid(); info.uid = getuid(); info.gid = getgid(); + if (!getcwd(info.cwd, sizeof(info.cwd))) + die("getcwd(): %s\n", strerror(errno)); do { int afd = accept(fd, NULL, NULL); @@ -308,6 +311,7 @@ static void cmd_info(int argc, char *argv[]) printf("\tPID:\t%d\n", info.pid); printf("\tUID:\t%u\n", info.uid); printf("\tGID:\t%u\n", info.gid); + printf("\tCWD:\t%s\n", info.cwd); } } -- 2.39.2