void
log_debug_init(int usetty)
{
- logInfo.dbfile = MyMalloc(sizeof(struct LogFile));
+ logInfo.dbfile = (struct LogFile*) MyMalloc(sizeof(struct LogFile));
logInfo.dbfile->next = 0; /* initialize debugging filename */
logInfo.dbfile->prev_p = 0;
/* Build the basic log string */
vd.vd_format = fmt;
- vd.vd_args = vl;
+ va_copy(vd.vd_args, vl);
/* save the length for writev */
/* Log format: "SYSTEM [SEVERITY]: log message" */
vector[0].iov_base = timebuf;
vector[1].iov_base = buf;
- vector[2].iov_base = "\n"; /* terminate lines with a \n */
+ vector[2].iov_base = (void*) "\n"; /* terminate lines with a \n */
vector[2].iov_len = 1;
/* write it out to the log file */
tmp = logInfo.freelist;
logInfo.freelist = tmp->next;
} else /* allocate a new one */
- tmp = MyMalloc(sizeof(struct LogFile));
+ tmp = (struct LogFile*) MyMalloc(sizeof(struct LogFile));
tmp->fd = -1; /* initialize the structure */
tmp->ref = 1;
desc->mark &= ~LOG_MARK_FILE; /* file has been reset to defaults */
/* no change, don't go to the trouble of destroying and recreating */
- if (desc->file && filename && !strcmp(desc->file->file, filename))
+ if (desc->file && desc->file->file && filename &&
+ !strcmp(desc->file->file, filename))
return 0;
/* debug log is special, since it has to be opened on fd 2 */
{
int i;
- for (i = 0; i < LS_LAST_SYSTEM; i++) {
+ for (i = 0; i < LS_LAST_SYSTEM; i++)
+ {
if (logDesc[i].mark & LOG_MARK_FILE) /* report file */
send_reply(to, SND_EXPLICIT | RPL_STATSFLINE, "F LOG %s FILE %s",
- logDesc[i].name, logDesc[i].file->file);
+ logDesc[i].name, (logDesc[i].file && logDesc[i].file->file ?
+ logDesc[i].file->file : "(terminal)"));
if (logDesc[i].mark & LOG_MARK_FACILITY) /* report facility */
send_reply(to, SND_EXPLICIT | RPL_STATSFLINE, "F LOG %s FACILITY %s",