diff options
author | Roger Leigh <rleigh@debian.org> | 2012-05-23 23:37:31 +0100 |
---|---|---|
committer | Roger Leigh <rleigh@debian.org> | 2012-05-23 23:45:40 +0100 |
commit | 023de5dcce7b7be68de9af7d4515ea3fb7e99dc3 (patch) | |
tree | 381f6078b98a1cb1e96f6af3a5a228a00244a1ed | |
parent | 7cb1d632d59f154a117af858215508b1c76398cc (diff) | |
download | schroot-023de5dcce7b7be68de9af7d4515ea3fb7e99dc3.tar.gz |
sbuild::session:
Handle case where we can't chdir to /. Should not fail, but
handle anyway.
-rw-r--r-- | sbuild/sbuild-session.cc | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/sbuild/sbuild-session.cc b/sbuild/sbuild-session.cc index 082d229e..58e040e2 100644 --- a/sbuild/sbuild-session.cc +++ b/sbuild/sbuild-session.cc @@ -1181,7 +1181,8 @@ session::setup_chroot (sbuild::chroot::ptr& session_chroot, // The setup scripts don't use our syslog fd. closelog(); - chdir("/"); + if (chdir("/")) + throw error("/", CHDIR, strerror(errno)); /* This is required to ensure the scripts run with uid=0 and gid=0, otherwise setuid programs such as mount(8) will fail. This should always succeed, because our euid=0 and egid=0.*/ |