Skip to content

Commit eadd80c

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 463dde8 commit eadd80c

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
@@ -1656,8 +1656,12 @@ get_set_pwd(void)
16561656
}
16571657
if (!fgets(pwdbuf, sizeof(pwdbuf), pwf))
16581658
{
1659-
fprintf(stderr, _("%s: could not read password from file \"%s\": %s\n"),
1660-
progname, pwfilename, strerror(errno));
1659+
if (ferror(pwf))
1660+
fprintf(stderr, _("%s: could not read password from file \"%s\": %s\n"),
1661+
progname, pwfilename, strerror(errno));
1662+
else
1663+
fprintf(stderr, _("%s: password file \"%s\" is empty\n"),
1664+
progname, pwfilename);
16611665
exit_nicely();
16621666
}
16631667
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