]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Make fopen of mime.conf on reconfigure a fail-soft condition, instead
authorhno <>
Mon, 1 Jan 2001 23:24:39 +0000 (23:24 +0000)
committerhno <>
Mon, 1 Jan 2001 23:24:39 +0000 (23:24 +0000)
of causing a crash and burn situation.

src/main.cc
src/mime.cc

index 323956989d803d2b83d015944aa71e0bbcebd9f2..ccf195b6601227fa310b99d02c8ceecc992cde41 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: main.cc,v 1.325 2000/12/30 23:29:07 wessels Exp $
+ * $Id: main.cc,v 1.326 2001/01/01 16:24:39 hno Exp $
  *
  * DEBUG: section 1     Startup and Main Loop
  * AUTHOR: Harvest Derived
@@ -346,7 +346,6 @@ mainReconfigure(void)
     authenticateShutdown();
     storeDirCloseSwapLogs();
     errorClean();
-    mimeFreeMemory();
     parseConfigFile(ConfigFile);
     _db_init(Config.Log.log, Config.debugOptions);
     ipcache_restart();         /* clear stuck entries */
index c6dd4f315b7c09e676307ababcf8e3350658f35a..2a6840c4b486da81b895109d3da2123e0075064c 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: mime.cc,v 1.96 2000/12/05 09:15:59 wessels Exp $
+ * $Id: mime.cc,v 1.97 2001/01/01 16:24:39 hno Exp $
  *
  * DEBUG: section 25    MIME Parsing
  * AUTHOR: Harvest Derived
@@ -49,7 +49,7 @@ typedef struct _mime_entry {
 } mimeEntry;
 
 static mimeEntry *MimeTable = NULL;
-static mimeEntry **MimeTableTail = NULL;
+static mimeEntry **MimeTableTail = &MimeTable;
 
 static void mimeLoadIconFile(const char *icon);
 
@@ -268,6 +268,11 @@ mimeGetViewOption(const char *fn)
     return m ? m->view_option : 0;
 }
 
+/* Initializes/reloads the mime table
+ * Note: Due to Solaris STDIO problems the caller should NOT
+ * call mimeFreeMemory on reconfigure. This way, if STDIO
+ * fails we at least have the old copy loaded.
+ */
 void
 mimeInit(char *filename)
 {
@@ -292,8 +297,7 @@ mimeInit(char *filename)
        debug(50, 1) ("mimeInit: %s: %s\n", filename, xstrerror());
        return;
     }
-    if (MimeTableTail == NULL)
-       MimeTableTail = &MimeTable;
+    mimeFreeMemory();
     while (fgets(buf, BUFSIZ, fp)) {
        if ((t = strchr(buf, '#')))
            *t = '\0';