[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

dnrd sighup crash fix



Here is a fix for a crash on x86 when you send dnrd a sighup. This problem shows up for sure on Slackware 7, but should happen everywhere. I haven't tested it extensively, but if you check the original code it becomes obvious why it needs to be changed. The only part that concerns me is the use of the semaphore, but I think it's needed because it's used elsewhere. This replaces a function in either main.c or master.c I can't remember right now, this is not my development machine.
 
static int reset_master(void)
{
    int i;
 
    log_msg(LOG_NOTICE, "resetting master DNS");
 
    sem_wait(&dnrd_sem);
 
    for (i = 0; i < dbc; i++) {
     free_dnsrec(dbv[i]);
    }
 
    if (dbv)
      {
      free(dbv);
      dbv = 0;
      }
 
    dbc = 0;
    dbmax = 0;
 
    sem_post(&dnrd_sem);
 
    return (0);
}

Reply to: