>>> Henrik Nordstrom wrote
> KevinL wrote:
> >
> > The following patch adds a comment asking if effectiveUser is always set (ie.
> > I suspect this portion of code never executes after the change for non-root
> > execution made the other day)
>
> It is always set. When started as non-root is is set to the current UID.
That was what I thought - in which case, the block of code that executes if
it's not set is probably worth removing... ;)
>
> It should not chdir to the swap directory, it should chdir to
> coredump_dir. And this regardless of any uid settings..
Yup, that's what I thought. But that function has it trying coredump_dir,
then checking effectiveUser, reporting current dir and returning if
effectiveUser is not set, otherwise trying to chdir into the first cache_dir.
>
> Assuming that the name of a cache_dir is a directory to where one can
> chdir is a bold assumption. Fails miserably for non-FS based stores.
So, my revised patch would cut more out:
RCS file: /cvsroot/squid/squid/src/main.c,v
retrieving revision 1.17
diff -u -r1.17 main.c
--- main.c 2001/01/12 08:20:33 1.17
+++ main.c 2001/01/30 01:49:29
@@ -430,21 +430,10 @@
debug(50, 0) ("chdir: %s: %s\n", Config.coredump_dir, xstrerror());
}
}
- if (!Config.effectiveUser) {
- char *p = getcwd(NULL, 0);
- debug(0, 1) ("Current Directory is %s\n", p);
- xfree(p);
- return;
- }
- /* we were probably started as root, so cd to a swap
- * directory in case we dump core */
- if (!chdir(storeSwapDir(0))) {
- debug(0, 1) ("Set Current Directory to %s\n", storeSwapDir(0));
- return;
- } else {
- debug(50, 0) ("%s: %s\n", storeSwapDir(0), xstrerror());
- fatal_dump("Cannot cd to swap directory?");
- }
+ /* If we don't have coredump_dir or couldn't cd there, report current dir */
+ char *p = getcwd(NULL, 0);
+ debug(0, 1) ("Current Directory is %s\n", p);
+ xfree(p);
}
static void
Received on Mon Jan 29 2001 - 18:50:46 MST
This archive was generated by hypermail pre-2.1.9 : Tue Dec 09 2003 - 16:13:26 MST