]> granicus.if.org Git - postgresql/commitdiff
Add logging to /contrib/pg_standby if -k couldn't clean up the log file.
authorBruce Momjian <bruce@momjian.us>
Sat, 3 Mar 2007 18:50:45 +0000 (18:50 +0000)
committerBruce Momjian <bruce@momjian.us>
Sat, 3 Mar 2007 18:50:45 +0000 (18:50 +0000)
Darcy Buskermolen

contrib/pg_standby/pg_standby.c

index 98d04c26f0710262df23b40b2f438620fcd44f78..733b01d133ce3b8a0796285ea175249663e84f32 100644 (file)
@@ -264,10 +264,15 @@ CustomizableCleanupPriorWALFiles(void)
 #else
                                        snprintf(WALFilePath, MAXPGPATH, "%s/%s", archiveLocation, xlde->d_name);
 #endif
-                                       rc = unlink(WALFilePath);
 
                                        if (debug)
-                                               fprintf(stderr, "\npg_standby: removed \"%s\"\n", WALFilePath);
+                                               fprintf(stderr, "\npg_standby: removing \"%s\"\n", WALFilePath);
+
+                                       rc = unlink(WALFilePath);
+                                       if (rc !=0 )
+                                               fprintf(stderr, "\npg_standby: ERROR failed to remove \"%s\" because %s\n", WALFilePath,  strerror(errno));
+
+
                                }
                        }
                }
@@ -315,7 +320,7 @@ CheckForExternalTrigger(void)
                rc = unlink(triggerPath);
                if (rc != 0)
                {
-                       fprintf(stderr, "\n ERROR: unable to remove \"%s\", rc=%d", triggerPath, rc);
+                       fprintf(stderr, "\n ERROR: unable to remove \"%s\", because %s", triggerPath, strerror(errno));
                        fflush(stderr);
                        exit(rc);
                }