Content-Length: 268453 | pFad | http://github.com/postgrespro/postgres/commit/198cbe0a0c4b539c9f9f3f2e9169d774d1d39a8e

F5 Give a proper error message if initdb password file is empty. · postgrespro/postgres@198cbe0 · GitHub
Skip to content

Commit 198cbe0

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 c0f279c commit 198cbe0

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
@@ -1663,8 +1663,12 @@ get_set_pwd(void)
16631663
}
16641664
if (!fgets(pwdbuf, sizeof(pwdbuf), pwf))
16651665
{
1666-
fprintf(stderr, _("%s: could not read password from file \"%s\": %s\n"),
1667-
progname, pwfilename, strerror(errno));
1666+
if (ferror(pwf))
1667+
fprintf(stderr, _("%s: could not read password from file \"%s\": %s\n"),
1668+
progname, pwfilename, strerror(errno));
1669+
else
1670+
fprintf(stderr, _("%s: password file \"%s\" is empty\n"),
1671+
progname, pwfilename);
16681672
exit_nicely();
16691673
}
16701674
fclose(pwf);

0 commit comments

Comments
 (0)








ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: http://github.com/postgrespro/postgres/commit/198cbe0a0c4b539c9f9f3f2e9169d774d1d39a8e

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy