diff --git a/src/bip.c b/src/bip.c index 9b35692..b87c594 100644 --- a/src/bip.c +++ b/src/bip.c @@ -848,7 +848,9 @@ static int validate_config(bip_t *bip) } } - if (strstr(conf_log_format, "%u") == NULL) + hash_it_init(&bip->users, &it); + hash_it_next(&it); + if (hash_it_item(&it) && !strstr(conf_log_format, "%u")) mylog(LOG_WARN, "log_format does not contain %%u, all users'" " logs will be mixed !"); return r; diff --git a/src/irc.c b/src/irc.c index a07db26..588f53b 100644 --- a/src/irc.c +++ b/src/irc.c @@ -2121,8 +2121,7 @@ void oidentd_dump(bip_t *bip) char tag_written = 0; if (stat(bip->oidentdpath, &stats) == -1) { - if (errno == ENOENT) { - f = fopen(bip->oidentdpath, "w+"); + if (errno == ENOENT && (f = fopen(bip->oidentdpath, "w+"))) fchmod(fileno(f), 0644); } else { mylog(LOG_WARN, "Can't open/create %s", @@ -2130,6 +2129,7 @@ void oidentd_dump(bip_t *bip) return; } } else { + /* strip previously autogenerated content */ char *content; f = fopen(bip->oidentdpath, "r+"); @@ -2141,10 +2141,8 @@ void oidentd_dump(bip_t *bip) content = (char *)malloc(stats.st_size + 1); - if (content == NULL){ + if (content == NULL) fatal("out of memory"); - return; - } if (fread(content, 1, stats.st_size, f) != (size_t)stats.st_size) {