diff --git a/src/backend/replication/basebackup.c b/src/backend/replication/basebackup.c
index 20d4ce36d88fbd9a2ec1f738779998ae7eac5db4..ba52ea8e989e9234f38128cf221c68963286fd9e 100644
--- a/src/backend/replication/basebackup.c
+++ b/src/backend/replication/basebackup.c
@@ -592,7 +592,7 @@ sendDir(char *path, int basepathlen, bool sizeonly)
 		{
 			if (errno != ENOENT)
 				ereport(ERROR,
-						(errcode(errcode_for_file_access()),
+						(errcode_for_file_access(),
 						 errmsg("could not stat file or directory \"%s\": %m",
 								pathbuf)));
 
@@ -634,7 +634,7 @@ sendDir(char *path, int basepathlen, bool sizeonly)
 			MemSet(linkpath, 0, sizeof(linkpath));
 			if (readlink(pathbuf, linkpath, sizeof(linkpath) - 1) == -1)
 				ereport(ERROR,
-						(errcode(errcode_for_file_access()),
+						(errcode_for_file_access(),
 						 errmsg("could not read symbolic link \"%s\": %m",
 								pathbuf)));
 			if (!sizeonly)
@@ -728,7 +728,7 @@ sendFile(char *readfilename, char *tarfilename, struct stat * statbuf)
 	fp = AllocateFile(readfilename, "rb");
 	if (fp == NULL)
 		ereport(ERROR,
-				(errcode(errcode_for_file_access()),
+				(errcode_for_file_access(),
 				 errmsg("could not open file \"%s\": %m", readfilename)));
 
 	/*