summaryrefslogtreecommitdiff
path: root/src/bin/psql/command.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/bin/psql/command.c')
-rw-r--r--src/bin/psql/command.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index b26e28006ec..764534a3ae0 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -264,14 +264,15 @@ exec_command(const char *cmd,
{
#ifndef WIN32
struct passwd *pw;
+ uid_t user_id = geteuid();
- errno = 0; /* clear errno before call */
- pw = getpwuid(geteuid());
+ errno = 0; /* clear errno before call */
+ pw = getpwuid(user_id);
if (!pw)
{
- psql_error("could not get home directory for user id %d: %s\n",
- (int) geteuid(), errno ?
- strerror(errno) : "user does not exist");
+ psql_error("could not get home directory for user id %ld: %s\n",
+ (long) user_id,
+ errno ? strerror(errno) : _("user does not exist"));
exit(EXIT_FAILURE);
}
dir = pw->pw_dir;