Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 053981f

Browse files
committed
Add logging to /contrib/pg_standby if -k couldn't clean up the log file.
Darcy Buskermolen
1 parent e52c4a6 commit 053981f

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

contrib/pg_standby/pg_standby.c

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -264,10 +264,15 @@ CustomizableCleanupPriorWALFiles(void)
264264
#else
265265
snprintf(WALFilePath, MAXPGPATH, "%s/%s", archiveLocation, xlde->d_name);
266266
#endif
267-
rc = unlink(WALFilePath);
268267

269268
if (debug)
270-
fprintf(stderr, "\npg_standby: removed \"%s\"\n", WALFilePath);
269+
fprintf(stderr, "\npg_standby: removing \"%s\"\n", WALFilePath);
270+
271+
rc = unlink(WALFilePath);
272+
if (rc !=0 )
273+
fprintf(stderr, "\npg_standby: ERROR failed to remove \"%s\" because %s\n", WALFilePath, strerror(errno));
274+
275+
271276
}
272277
}
273278
}
@@ -315,7 +320,7 @@ CheckForExternalTrigger(void)
315320
rc = unlink(triggerPath);
316321
if (rc != 0)
317322
{
318-
fprintf(stderr, "\n ERROR: unable to remove \"%s\", rc=%d", triggerPath, rc);
323+
fprintf(stderr, "\n ERROR: unable to remove \"%s\", because %s", triggerPath, strerror(errno));
319324
fflush(stderr);
320325
exit(rc);
321326
}

0 commit comments

Comments
 (0)