Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions src/conf.c
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,6 @@
#include "rotater.h"
#include "zc_defs.h"

#ifdef _WIN32
#define STATS_FILE stat
#else
#define STATS_FILE lstat
#endif

/*******************************************************************************/
#define ZLOG_CONF_DEFAULT_FORMAT "default = \"%D %V [%p:%F:%L] %m%n\""
#define ZLOG_CONF_DEFAULT_RULE "*.* >stdout"
Expand Down Expand Up @@ -471,11 +465,17 @@ static int zlog_conf_build_with_file(zlog_conf_t * a_conf)
int section = 0;
/* [global:1] [levels:2] [formats:3] [rules:4] */

if (STATS_FILE(a_conf->file, &a_stat)) {
if (stat(a_conf->file, &a_stat)) {
zc_error("lstat conf file[%s] fail, errno[%d]", a_conf->file,
errno);
return -1;
}

if (!S_ISREG(a_stat.st_mode)) {
zc_error("conf file[%s] is not a regular file", a_conf->file);
return -1;
}

localtime_r(&(a_stat.st_mtime), &local_time);
strftime(a_conf->mtime, sizeof(a_conf->mtime), "%Y-%m-%d %H:%M:%S", &local_time);

Expand Down