From d7f34e6863b4d533d0fc4ada8f020308dfae107d Mon Sep 17 00:00:00 2001
From: Rushabh Lathia <rushabh.lathia@enterprisedb.com>
Date: Sat, 16 Nov 2019 11:57:04 +0530
Subject: [PATCH] Fix warnings.

---
 src/backend/replication/basebackup.c  | 7 +++++--
 src/bin/pg_basebackup/pg_basebackup.c | 2 +-
 2 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/src/backend/replication/basebackup.c b/src/backend/replication/basebackup.c
index 9812f2a..273f837 100644
--- a/src/backend/replication/basebackup.c
+++ b/src/backend/replication/basebackup.c
@@ -902,6 +902,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
@@ -923,8 +924,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 c56246f..508e4a6 100644
--- a/src/bin/pg_basebackup/pg_basebackup.c
+++ b/src/bin/pg_basebackup/pg_basebackup.c
@@ -1194,7 +1194,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);
-- 
1.8.3.1

