--------------------- PatchSet 11609 Date: 2007/08/31 13:52:10 Author: hno Branch: SQUID_2_6 Tag: (none) Log: MFC: Bug #2066: chdir after chroot Merged changes: 2007/08/30 21:52:47 hno +2 -2 MFC: Bug #2066: chdir after chroot Members: src/main.c:1.393.2.3->1.393.2.4 Index: squid/src/main.c =================================================================== RCS file: /cvsroot/squid/squid/src/main.c,v retrieving revision 1.393.2.3 retrieving revision 1.393.2.4 diff -u -r1.393.2.3 -r1.393.2.4 --- squid/src/main.c 23 Jun 2007 21:33:24 -0000 1.393.2.3 +++ squid/src/main.c 31 Aug 2007 13:52:10 -0000 1.393.2.4 @@ -1,6 +1,6 @@ /* - * $Id: main.c,v 1.393.2.3 2007/06/23 21:33:24 hno Exp $ + * $Id: main.c,v 1.393.2.4 2007/08/31 13:52:10 hno Exp $ * * DEBUG: section 1 Startup and Main Loop * AUTHOR: Harvest Derived @@ -522,7 +522,7 @@ mainInitialize(void) { /* chroot if configured to run inside chroot */ - if (Config.chroot_dir && chroot(Config.chroot_dir)) { + if (Config.chroot_dir && (chroot(Config.chroot_dir) != 0 || chdir("/") != 0)) { fatal("failed to chroot"); } if (opt_catch_signals) {