Commit f3692079 authored by Tom Lane's avatar Tom Lane

Fix another portability issue in pg_basebackup.

The target of sscanf with a %o format had better be of integer width,
but "mode_t" conceivably isn't that.  Another compiler warning seen
only on some platforms; this one I think is potentially a real bug
and not just a warning.
parent dd5f0db9
...@@ -483,7 +483,7 @@ ReceiveAndUnpackTarFile(PGconn *conn, PGresult *res, int rownum) ...@@ -483,7 +483,7 @@ ReceiveAndUnpackTarFile(PGconn *conn, PGresult *res, int rownum)
if (file == NULL) if (file == NULL)
{ {
mode_t filemode; int filemode;
/* /*
* No current file, so this must be the header for a new file * No current file, so this must be the header for a new file
...@@ -540,7 +540,7 @@ ReceiveAndUnpackTarFile(PGconn *conn, PGresult *res, int rownum) ...@@ -540,7 +540,7 @@ ReceiveAndUnpackTarFile(PGconn *conn, PGresult *res, int rownum)
disconnect_and_exit(1); disconnect_and_exit(1);
} }
#ifndef WIN32 #ifndef WIN32
if (chmod(fn, filemode)) if (chmod(fn, (mode_t) filemode))
fprintf(stderr, _("%s: could not set permissions on directory \"%s\": %s\n"), fprintf(stderr, _("%s: could not set permissions on directory \"%s\": %s\n"),
progname, fn, strerror(errno)); progname, fn, strerror(errno));
#endif #endif
...@@ -580,7 +580,7 @@ ReceiveAndUnpackTarFile(PGconn *conn, PGresult *res, int rownum) ...@@ -580,7 +580,7 @@ ReceiveAndUnpackTarFile(PGconn *conn, PGresult *res, int rownum)
} }
#ifndef WIN32 #ifndef WIN32
if (chmod(fn, filemode)) if (chmod(fn, (mode_t) filemode))
fprintf(stderr, _("%s: could not set permissions on file \"%s\": %s\n"), fprintf(stderr, _("%s: could not set permissions on file \"%s\": %s\n"),
progname, fn, strerror(errno)); progname, fn, strerror(errno));
#endif #endif
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment