Changeset 463 for trunk/src


Ignore:
Timestamp:
Feb 17, 2015, 5:43:59 PM (10 years ago)
Author:
katerina
Message:

Fix for ticket #363 (database load on init when missing file in config).

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/sh_hash.c

    r458 r463  
    13251325
    13261326  SL_ENTER(_("sh_hash_init"));
     1327
     1328  if ( sh.flag.checkSum == SH_CHECK_INIT )
     1329    {
     1330      dlog(1, FIL__, __LINE__,
     1331           _("Attempt to load the baseline database during initialisation. This is an internal error, please report it to the developer.\n"));
     1332      SH_ABORT;
     1333      aud_exit (FIL__, __LINE__, EXIT_FAILURE);
     1334    }
    13271335
    13281336  SH_MUTEX_LOCK(mutex_hash);
     
    21572165{
    21582166  sh_file_t * p;
    2159   int retval;
    2160 
    2161   if (IsInit != 1)
    2162     sh_hash_init();
    2163 
    2164   SH_MUTEX_LOCK(mutex_hash);
    2165   p = sh_hash_have_it_int (filename);
    2166   if (p)
    2167     retval = p->fflags;
    2168   else
    2169     retval = -1;
    2170   SH_MUTEX_UNLOCK(mutex_hash);
     2167  int retval = 0;
     2168
     2169  if ( sh.flag.checkSum != SH_CHECK_INIT )
     2170    {
     2171      if (IsInit != 1)
     2172        sh_hash_init();
     2173     
     2174      SH_MUTEX_LOCK(mutex_hash);
     2175      p = sh_hash_have_it_int (filename);
     2176      if (p)
     2177        retval = p->fflags;
     2178      else
     2179        retval = -1;
     2180      SH_MUTEX_UNLOCK(mutex_hash);
     2181    }
    21712182  return retval;
    21722183}
     
    21752186{
    21762187  sh_file_t * p;
    2177   int retval;
    2178 
    2179   if (IsInit != 1)
    2180     sh_hash_init();
    2181 
    2182   SH_MUTEX_LOCK(mutex_hash);
    2183   p = sh_hash_have_it_int (filename);
    2184   if (p)
    2185     {
    2186       p->fflags = flags;
    2187       retval = 0;
    2188     }
    2189   else
    2190     retval = -1;
    2191   SH_MUTEX_UNLOCK(mutex_hash);
     2188  int retval = 0;
     2189
     2190  if ( sh.flag.checkSum != SH_CHECK_INIT )
     2191    {
     2192      if (IsInit != 1)
     2193        sh_hash_init();
     2194     
     2195      SH_MUTEX_LOCK(mutex_hash);
     2196      p = sh_hash_have_it_int (filename);
     2197      if (p)
     2198        {
     2199          p->fflags = flags;
     2200          retval = 0;
     2201        }
     2202      else
     2203        retval = -1;
     2204      SH_MUTEX_UNLOCK(mutex_hash);
     2205    }
    21922206  return retval;
    21932207}
     
    21992213  sh_file_t * p;
    22002214
    2201   if (IsInit != 1)
    2202     sh_hash_init();
    2203 
    2204   SH_MUTEX_LOCK(mutex_hash);
    2205   p = sh_hash_have_it_int (filename);
    2206   if (p)
    2207     {
    2208       p->fflags |= flag_to_set;
    2209     }
    2210   SH_MUTEX_UNLOCK(mutex_hash);
     2215  if ( sh.flag.checkSum != SH_CHECK_INIT )
     2216    {
     2217      if (IsInit != 1)
     2218        sh_hash_init();
     2219     
     2220      SH_MUTEX_LOCK(mutex_hash);
     2221      p = sh_hash_have_it_int (filename);
     2222      if (p)
     2223        {
     2224          p->fflags |= flag_to_set;
     2225        }
     2226      SH_MUTEX_UNLOCK(mutex_hash);
     2227    }
    22112228  return;
    22122229}
     
    22182235  sh_file_t * p;
    22192236
    2220   if (IsInit != 1)
    2221     sh_hash_init();
    2222 
    2223   SH_MUTEX_LOCK(mutex_hash);
    2224   p = sh_hash_have_it_int (filename);
    2225   if (p)
    2226     {
    2227       p->fflags &= ~flag_to_clear;
    2228     }
    2229   SH_MUTEX_UNLOCK(mutex_hash);
     2237  if ( sh.flag.checkSum != SH_CHECK_INIT )
     2238    {
     2239      if (IsInit != 1)
     2240        sh_hash_init();
     2241     
     2242      SH_MUTEX_LOCK(mutex_hash);
     2243      p = sh_hash_have_it_int (filename);
     2244      if (p)
     2245        {
     2246          p->fflags &= ~flag_to_clear;
     2247        }
     2248      SH_MUTEX_UNLOCK(mutex_hash);
     2249    }
    22302250  return;
    22312251}
Note: See TracChangeset for help on using the changeset viewer.