diff --git a/src/backend/replication/basebackup.c b/src/backend/replication/basebackup.c index 5a2a7fc..990d758 100644 --- a/src/backend/replication/basebackup.c +++ b/src/backend/replication/basebackup.c @@ -903,6 +903,7 @@ AddFileToManifest(StringInfo manifest, const char *tsoid, static char timebuf[128]; static char shatextbuf[PG_SHA256_DIGEST_LENGTH * 2 + 1]; int shatextlen; + struct pg_tm *tm; /* * If this file is part of a tablespace, the filename passed to this @@ -924,8 +925,10 @@ AddFileToManifest(StringInfo manifest, const char *tsoid, * and since time zone definitions can change, possibly causing confusion, * use GMT always. */ - pg_strftime(timebuf, sizeof(timebuf), "%Y-%m-%d %H:%M:%S %Z", - pg_gmtime(&mtime)); + tm = pg_gmtime(&mtime); + if (tm == NULL) + elog(ERROR, "could not convert epoch to timestamp: %m"); + pg_strftime(timebuf, sizeof(timebuf), "%Y-%m-%d %H:%M:%S %Z", tm); /* Convert checksum to hexadecimal. */ shatextlen = diff --git a/src/bin/pg_basebackup/pg_basebackup.c b/src/bin/pg_basebackup/pg_basebackup.c index 2abe632..60d3a53 100644 --- a/src/bin/pg_basebackup/pg_basebackup.c +++ b/src/bin/pg_basebackup/pg_basebackup.c @@ -1200,7 +1200,7 @@ ReceiveTarFile(PGconn *conn, PGresult *res, int rownum) initPQExpBuffer(&buf); ReceiveBackupManifestInMemory(conn, &buf); - if (PQExpBufferBroken(&buf)) + if (PQExpBufferDataBroken(buf)) { pg_log_error("out of memory"); exit(1);