Skip to content

Commit 2df66f0

Browse files
committed
Give a proper error message if initdb password file is empty.
Used to say just "could not read password from file "...": Success", which isn't very informative. Mats Erik Andersson. Backpatch to all supported versions.
1 parent 8571ecb commit 2df66f0

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/bin/initdb/initdb.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1598,8 +1598,12 @@ get_set_pwd(void)
15981598
}
15991599
if (!fgets(pwdbuf, sizeof(pwdbuf), pwf))
16001600
{
1601-
fprintf(stderr, _("%s: could not read password from file \"%s\": %s\n"),
1602-
progname, pwfilename, strerror(errno));
1601+
if (ferror(pwf))
1602+
fprintf(stderr, _("%s: could not read password from file \"%s\": %s\n"),
1603+
progname, pwfilename, strerror(errno));
1604+
else
1605+
fprintf(stderr, _("%s: password file \"%s\" is empty\n"),
1606+
progname, pwfilename);
16031607
exit_nicely();
16041608
}
16051609
fclose(pwf);

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy