Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit82b07eb

Browse files
committed
Remove a couple of strerror() calls
Change to using %m in the error message string. We need to be a bitcareful here to preserve errno until we need to print it.This change avoids the use of not-thread-safe strerror() and unifiessome error message strings, and maybe makes the code appear moreconsistent.Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>Discussion:https://www.postgresql.org/message-id/flat/daa87d79-c044-46c4-8458-8d77241ed7b0%40eisentraut.org
1 parenta68159f commit82b07eb

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

‎src/backend/libpq/hba.c

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -624,8 +624,11 @@ open_auth_file(const char *filename, int elevel, int depth,
624624
errmsg("could not open file \"%s\": %m",
625625
filename)));
626626
if (err_msg)
627-
*err_msg=psprintf("could not open file \"%s\": %s",
628-
filename,strerror(save_errno));
627+
{
628+
errno=save_errno;
629+
*err_msg=psprintf("could not open file \"%s\": %m",
630+
filename);
631+
}
629632
/* the caller may care about some specific errno */
630633
errno=save_errno;
631634
returnNULL;
@@ -762,8 +765,9 @@ tokenize_auth_file(const char *filename, FILE *file, List **tok_lines,
762765
ereport(elevel,
763766
(errcode_for_file_access(),
764767
errmsg("could not read file \"%s\": %m",filename)));
765-
err_msg=psprintf("could not read file \"%s\": %s",
766-
filename,strerror(save_errno));
768+
errno=save_errno;
769+
err_msg=psprintf("could not read file \"%s\": %m",
770+
filename);
767771
break;
768772
}
769773

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp