From: hno <> Date: Thu, 9 Jan 2003 18:49:04 +0000 (+0000) Subject: Bugzilla 493: chroot_dir messes up all path checks.. this patch makes X-Git-Tag: SQUID_3_0_PRE1~469 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=08577e16e6c4aa38f8b3fd69b25662e6f1984667;p=thirdparty%2Fsquid.git Bugzilla 493: chroot_dir messes up all path checks.. this patch makes life easier by assuming all paths are within the chroot directory.. --- diff --git a/src/cache_cf.cc b/src/cache_cf.cc index 6e27c4f841..61914b01cf 100644 --- a/src/cache_cf.cc +++ b/src/cache_cf.cc @@ -1,6 +1,6 @@ /* - * $Id: cache_cf.cc,v 1.424 2002/12/27 10:26:33 robertc Exp $ + * $Id: cache_cf.cc,v 1.425 2003/01/09 11:49:04 hno Exp $ * * DEBUG: section 3 Configuration File Parsing * AUTHOR: Harvest Derived @@ -2534,9 +2534,14 @@ void requirePathnameExists(const char *name, const char *path) { struct stat sb; + char pathbuf[BUFSIZ]; assert(path != NULL); + if (Config.chroot_dir) { + snprintf(pathbuf, BUFSIZ, "%s/%s", Config.chroot_dir, path); + path = pathbuf; + } if (stat(path, &sb) < 0) - fatalf("%s: %s", path, xstrerror()); + fatalf("%s %s: %s", name, path, xstrerror()); } char *