Skip to content

Commit c287aab

Browse files
committed
fix: stat conflict with MinGW definitions
1 parent b03c16a commit c287aab

5 files changed

Lines changed: 9 additions & 12 deletions

File tree

src/conf.c

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -37,12 +37,6 @@
3737
#include "rotater.h"
3838
#include "zc_defs.h"
3939

40-
#ifdef _WIN32
41-
#define STATS_FILE stat
42-
#else
43-
#define STATS_FILE lstat
44-
#endif
45-
4640
/*******************************************************************************/
4741
#define ZLOG_CONF_DEFAULT_FORMAT "default = \"%D %V [%p:%F:%L] %m%n\""
4842
#define ZLOG_CONF_DEFAULT_RULE "*.* >stdout"
@@ -456,7 +450,7 @@ static int zlog_conf_build_with_string(zlog_conf_t *a_conf,
456450
static int zlog_conf_build_with_file(zlog_conf_t * a_conf)
457451
{
458452
int rc = 0;
459-
struct zlog_stat a_stat;
453+
struct zlog_stat_t a_stat;
460454
struct tm local_time;
461455
FILE *fp = NULL;
462456

@@ -471,7 +465,7 @@ static int zlog_conf_build_with_file(zlog_conf_t * a_conf)
471465
int section = 0;
472466
/* [global:1] [levels:2] [formats:3] [rules:4] */
473467

474-
if (STATS_FILE(a_conf->file, &a_stat)) {
468+
if (zlog_stat(a_conf->file, &a_stat)) {
475469
zc_error("lstat conf file[%s] fail, errno[%d]", a_conf->file,
476470
errno);
477471
return -1;

src/rotater.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -509,7 +509,7 @@ int zlog_rotater_rotate(zlog_rotater_t *a_rotater,
509509
char *archive_path, long archive_max_size, int archive_max_count)
510510
{
511511
int rc = 0;
512-
struct zlog_stat info;
512+
struct zlog_stat_t info;
513513

514514
zc_assert(base_path, -1);
515515

src/rule.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ static char * zlog_rule_gen_archive_path(zlog_rule_t *a_rule, zlog_thread_t *a_t
171171
static int zlog_rule_output_static_file_rotate(zlog_rule_t * a_rule, zlog_thread_t * a_thread)
172172
{
173173
size_t len;
174-
struct zlog_stat info;
174+
struct zlog_stat_t info;
175175
int fd;
176176

177177
if (zlog_format_gen_msg(a_rule->format, a_thread)) {
@@ -291,7 +291,7 @@ static int zlog_rule_output_dynamic_file_rotate(zlog_rule_t * a_rule, zlog_threa
291291
int fd;
292292
char *path;
293293
size_t len;
294-
struct zlog_stat info;
294+
struct zlog_stat_t info;
295295

296296
zlog_rule_gen_path(a_rule, a_thread);
297297

src/version.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
#define ZLOG_VERSION "1.2.12"
1+
#define ZLOG_VERSION "1.2.18"

src/zc_xplatform.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,12 +52,15 @@
5252
#if defined(__APPLE__) && !defined(MAC_OS_X_VERSION_10_6)
5353
#define zlog_fstat fstat64
5454
#define zlog_stat stat64
55+
#define zlog_stat_t stat64
5556
#elif defined(_WIN32)
5657
#define zlog_fstat _fstat
5758
#define zlog_stat _stat
59+
#define zlog_stat_t _stat
5860
#else
5961
#define zlog_fstat fstat
6062
#define zlog_stat stat
63+
#define zlog_stat_t stat
6164
#endif
6265

6366
/* Define zlog_fsync to fdatasync() in Linux and fsync() for all the rest */

0 commit comments

Comments
 (0)