]> code.citadel.org Git - citadel.git/commitdiff
proxy.c: cache dir create now dies on any error except EEXIST
authorArt Cancro <ajc@citadel.org>
Fri, 16 Oct 1998 00:45:33 +0000 (00:45 +0000)
committerArt Cancro <ajc@citadel.org>
Fri, 16 Oct 1998 00:45:33 +0000 (00:45 +0000)
citadel/ChangeLog
citadel/proxy.c

index 780178e077b62cc3432de0bd4c0b5800f7729bbe..c683d66cbd2cc36c888e9752a2ff7b96af11c14a 100644 (file)
@@ -4,6 +4,7 @@ Thu Oct 15 19:27:32 EDT 1998 Art Cancro <ajc@uncnsrd.mt-kisco.ny.us>
          and moving messages.
        * setup.c: system-default message expire policy of "number of
          messages, 150" is now a default configuration instead of a temp hack
+       * proxy.c: cache dir create now dies on any error except EEXIST
 
 Wed Oct 14 22:41:16 EDT 1998 Art Cancro <ajc@uncnsrd.mt-kisco.ny.us>
        * Misc code cleanup
index e7853ccdba29a35f7d9f7fea8b2e46ea6bd1e73f..dca2e8dafb9edf5d228fd5563f1b026324fd2481 100644 (file)
@@ -366,11 +366,17 @@ void main(int argc, char *argv[]) {
        char buf[256];
        int pid;
 
-       /* Create the cache directory.  Ignore any error return, 'cuz that
-        * just means it's already there.  FIX... this really should check
-        * for that particular error.
+       /* Create the cache directory.  Die on any error *except* EEXIST
+        * because it's perfectly ok if the cache already exists.
         */
-       mkdir(CACHE_DIR, 0700);
+       if (mkdir(CACHE_DIR, 0700)!=0) {
+               if (errno != EEXIST) {
+                       printf("%d Error creating cache directory: %s\n",
+                               ERROR+INTERNAL_ERROR,
+                               strerror(errno));
+                       exit(errno);
+                       }
+               }
 
        /* Now go there */
        if (chdir(CACHE_DIR) != 0) exit(errno);