Re: squid -z fails

From: Miquel van Smoorenburg <miquels@dont-contact.us>
Date: 4 Dec 1997 16:51:33 +0100

In article <Pine.LNX.3.95.971204082124.8292A-100000@peachy.FRUIT>,
Patrick Bauer <bauerp@niagara.com> wrote:
>
>I've installed the squid-1.1.18 rpm for Redhat... and i type squid -z to
>create the cache directory structure... and this is the message that i
>get...
>
>97/12/04 08:22:29| Creating Swap Directories
>FATAL: Failed to make swap directory /var/spool/cache: (13) Permission
>denied

It's a bug in 1.1.17 and 1.1.18. Linux returns EPERM instead of EEXIST
if you try to create a subdirectory that already exists in a directory for
which you have no write access. I fixed it (for 1.1.17) like this:

--- squid-1.1.17.orig/src/store.c
+++ squid-1.1.17/src/store.c
@@ -2295,7 +2295,11 @@
 static void
 storeCreateDirectory(const char *path, int lvl)
 {
- if (mkdir(path, 0755) == 0) {
+ struct stat st;
+
+ if (stat(path, &st) == 0 && S_ISDIR(st.st_mode)) {
+ debug(20, lvl, "%s exists\n", path);
+ } else if (mkdir(path, 0755) == 0) {
         debug(20, lvl, "%s created\n", path);
     } else if (errno == EEXIST) {
         debug(20, lvl, "%s exists\n", path);

Mike.

-- 
 Miquel van Smoorenburg |  Studying to be a technomage   <*>
    miquels@cistron.nl  | "May you live in interesting times"
Received on Thu Dec 04 1997 - 08:00:04 MST

This archive was generated by hypermail pre-2.1.9 : Tue Dec 09 2003 - 16:37:50 MST