diff options
Diffstat (limited to 'progs/capsh.c')
-rw-r--r-- | progs/capsh.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/progs/capsh.c b/progs/capsh.c index 4c32279..52336d7 100644 --- a/progs/capsh.c +++ b/progs/capsh.c @@ -278,10 +278,16 @@ int main(int argc, char *argv[], char *envp[]) perror("unable to lower CAP_SYS_CHROOT"); exit(1); } + /* + * Given we are now in a new directory tree, its good practice + * to start off in a sane location + */ + status = chdir("/"); + cap_free(orig); if (status != 0) { - fprintf(stderr, "Unable to chroot to [%s]", argv[i]+9); + fprintf(stderr, "Unable to chroot/chdir to [%s]", argv[i]+9); exit(1); } } else if (!memcmp("--secbits=", argv[i], 10)) { |