Skip to content

Commit 1ff9059

Browse files
committed
Replaced the function strftime with pg_strftime for logs in Windows
1 parent df0cd65 commit 1ff9059

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed

gen_probackup_project.pl

+1
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,7 @@ sub build_pgprobackup
182182
$probackup->AddFile("$pgsrc/src/bin/pg_rewind/datapagemap.c");
183183

184184
$probackup->AddFile("$pgsrc/src/interfaces/libpq/pthread-win32.c");
185+
$probackup->AddFile("$pgsrc/src/timezone/strftime.c");
185186

186187
$probackup->AddIncludeDir("$pgsrc/src/bin/pg_basebackup");
187188
$probackup->AddIncludeDir("$pgsrc/src/bin/pg_rewind");

src/utils/logger.c

+4
Original file line numberDiff line numberDiff line change
@@ -470,7 +470,11 @@ logfile_getname(const char *format, time_t timestamp)
470470
len = strlen(filename);
471471

472472
/* Treat log_filename as a strftime pattern */
473+
#ifdef WIN32
474+
if (pg_strftime(filename + len, MAXPGPATH - len, format, tm) <= 0)
475+
#else
473476
if (strftime(filename + len, MAXPGPATH - len, format, tm) <= 0)
477+
#endif
474478
elog_stderr(ERROR, "strftime(%s) failed: %s", format, strerror(errno));
475479

476480
return filename;

0 commit comments

Comments
 (0)