--------------------- PatchSet 11595 Date: 2007/08/30 21:52:47 Author: hno Branch: HEAD Tag: (none) Log: MFC: Bug #2066: chdir after chroot Members: src/main.c:1.398->1.399 Index: squid/src/main.c =================================================================== RCS file: /cvsroot/squid/squid/src/main.c,v retrieving revision 1.398 retrieving revision 1.399 diff -u -r1.398 -r1.399 --- squid/src/main.c 4 Jul 2007 00:12:11 -0000 1.398 +++ squid/src/main.c 30 Aug 2007 21:52:47 -0000 1.399 @@ -1,6 +1,6 @@ /* - * $Id: main.c,v 1.398 2007/07/04 00:12:11 hno Exp $ + * $Id: main.c,v 1.399 2007/08/30 21:52:47 hno Exp $ * * DEBUG: section 1 Startup and Main Loop * AUTHOR: Harvest Derived @@ -526,7 +526,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) {