diff options
Diffstat (limited to 'src/bin/pg_basebackup/pg_receivewal.c')
-rw-r--r-- | src/bin/pg_basebackup/pg_receivewal.c | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/src/bin/pg_basebackup/pg_receivewal.c b/src/bin/pg_basebackup/pg_receivewal.c index ed9d7f6378a..8be8d48a8ad 100644 --- a/src/bin/pg_basebackup/pg_receivewal.c +++ b/src/bin/pg_basebackup/pg_receivewal.c @@ -284,6 +284,7 @@ FindStreamingStart(uint32 *tli) char buf[4]; int bytes_out; char fullpath[MAXPGPATH * 2]; + int r; snprintf(fullpath, sizeof(fullpath), "%s/%s", basedir, dirent->d_name); @@ -300,10 +301,15 @@ FindStreamingStart(uint32 *tli) progname, fullpath, strerror(errno)); disconnect_and_exit(1); } - if (read(fd, (char *) buf, sizeof(buf)) != sizeof(buf)) + r = read(fd, (char *) buf, sizeof(buf)); + if (r != sizeof(buf)) { - fprintf(stderr, _("%s: could not read compressed file \"%s\": %s\n"), - progname, fullpath, strerror(errno)); + if (r < 0) + fprintf(stderr, _("%s: could not read compressed file \"%s\": %s\n"), + progname, fullpath, strerror(errno)); + else + fprintf(stderr, _("%s: could not read compressed file \"%s\": read %d of %zu\n"), + progname, fullpath, r, sizeof(buf)); disconnect_and_exit(1); } |