]> granicus.if.org Git - postgresql/commitdiff
Fix overly-complicated usage of errcode_for_file_access().
authorHeikki Linnakangas <heikki.linnakangas@iki.fi>
Sat, 22 Oct 2011 17:16:05 +0000 (20:16 +0300)
committerHeikki Linnakangas <heikki.linnakangas@iki.fi>
Sat, 22 Oct 2011 17:22:12 +0000 (20:22 +0300)
No need to do  "errcode(errcode_for_file_access())", just
"errcode_for_file_access()" is enough. The extra errcode() call is useless
but harmless, so there's no user-visible bug here. Nevertheless, backpatch
to 9.1 where this code were added.

src/backend/replication/basebackup.c

index 231a1de2f5ec68996d9de0c7e346e828c78f2398..d6ed49a26faa35ea78968375466eec305aa7d5e4 100644 (file)
@@ -586,7 +586,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)));
 
@@ -628,7 +628,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)
@@ -722,7 +722,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)));
 
        /*