aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/backend/libpq/hba.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/src/backend/libpq/hba.c b/src/backend/libpq/hba.c
index 75d588e36a1..2fd96a71294 100644
--- a/src/backend/libpq/hba.c
+++ b/src/backend/libpq/hba.c
@@ -624,8 +624,11 @@ open_auth_file(const char *filename, int elevel, int depth,
errmsg("could not open file \"%s\": %m",
filename)));
if (err_msg)
- *err_msg = psprintf("could not open file \"%s\": %s",
- filename, strerror(save_errno));
+ {
+ errno = save_errno;
+ *err_msg = psprintf("could not open file \"%s\": %m",
+ filename);
+ }
/* the caller may care about some specific errno */
errno = save_errno;
return NULL;
@@ -762,8 +765,9 @@ tokenize_auth_file(const char *filename, FILE *file, List **tok_lines,
ereport(elevel,
(errcode_for_file_access(),
errmsg("could not read file \"%s\": %m", filename)));
- err_msg = psprintf("could not read file \"%s\": %s",
- filename, strerror(save_errno));
+ errno = save_errno;
+ err_msg = psprintf("could not read file \"%s\": %m",
+ filename);
break;
}