From: hno <> Date: Mon, 1 Jan 2001 23:24:39 +0000 (+0000) Subject: Make fopen of mime.conf on reconfigure a fail-soft condition, instead X-Git-Tag: SQUID_3_0_PRE1~1717 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=00fa6528249b24afb5c2c51fe050011d0c56d1ed;p=thirdparty%2Fsquid.git Make fopen of mime.conf on reconfigure a fail-soft condition, instead of causing a crash and burn situation. --- diff --git a/src/main.cc b/src/main.cc index 323956989d..ccf195b660 100644 --- a/src/main.cc +++ b/src/main.cc @@ -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 */ diff --git a/src/mime.cc b/src/mime.cc index c6dd4f315b..2a6840c4b4 100644 --- a/src/mime.cc +++ b/src/mime.cc @@ -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';