On 2013-02-13 12:09:37 -0300, Alvaro Herrera wrote: > Here's an updated version of pg_xlogdump. This is rebased on top of the > committed xlogreader, palloc restructuring and libpgcommon, PG_RMGR > stuff, and is basically a revamped version of what Andres submitted in > http://www.postgresql.org/message-id/1357672187-7693-5-git-send-email-and...@2ndquadrant.com
Two tiny followup bits, I had fixed since: * one copy-and-paste-o in an error message * replace stupid directory verification implementation * fix include in compat.c to include utils/timestamp.h instead of datatype/ Greetings, Andres Freund -- Andres Freund http://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Training & Services
diff --git a/contrib/pg_xlogdump/compat.c b/contrib/pg_xlogdump/compat.c index a3c98c6..dc54bad 100644 --- a/contrib/pg_xlogdump/compat.c +++ b/contrib/pg_xlogdump/compat.c @@ -21,7 +21,7 @@ #include "catalog/catalog.h" #include "catalog/pg_tablespace.h" #include "common/fe_memutils.h" -#include "datatype/timestamp.h" +#include "utils/timestamp.h" #include "lib/stringinfo.h" #include "storage/relfilenode.h" diff --git a/contrib/pg_xlogdump/pg_xlogdump.c b/contrib/pg_xlogdump/pg_xlogdump.c index c2ed1b8..9d8597f 100644 --- a/contrib/pg_xlogdump/pg_xlogdump.c +++ b/contrib/pg_xlogdump/pg_xlogdump.c @@ -12,6 +12,7 @@ #define FRONTEND 1 #include "postgres.h" +#include <dirent.h> #include <unistd.h> #include "rmgrdesc.h" @@ -64,19 +65,16 @@ fatal_error(const char *fmt,...) } /* - * Check whether directory exists and whether we can open it. - * errno is kept set so that the caller can report errors. + * Check whether directory exists and whether we can open it. Keep errno set so + * that the caller can report errors somewhat more accurate. */ static bool verify_directory(const char *directory) { - int fd = open(directory, O_DIRECTORY | O_RDONLY); - - if (fd < 0) + DIR *dir = opendir(directory); + if (dir == NULL) return false; - - close(fd); - errno = 0; /* ignore errors in this case */ + closedir(dir); return true; } @@ -560,7 +558,7 @@ main(int argc, char **argv) else if (!XLByteInSeg(private.startptr, segno)) { fprintf(stderr, - "%s: end log position %X/%X is not inside file \"%s\"\n", + "%s: start log position %X/%X is not inside file \"%s\"\n", progname, (uint32) (private.startptr >> 32), (uint32) private.startptr,
-- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers