postgres.git / summary / log / commit / refs
commit d67be559ed8a43248c11f165d70b9dfd6439bb61
Author: Heikki Linnakangas <heikki.linnakangas@iki.fi>
Date: Fri Dec 05 12:27:56 2014 +0000
First released in: 9.5.0, 9.0.19, 9.1.15, 9.2.10, 9.3.6, 9.4.0
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.
src/bin/initdb/initdb.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/src/bin/initdb/initdb.c b/src/bin/initdb/initdb.c
index e35f7689f7f..d54c017aa80 100644
--- a/src/bin/initdb/initdb.c
+++ b/src/bin/initdb/initdb.c
@@ -1430,8 +1430,12 @@ get_set_pwd(void)
}
if (!fgets(pwdbuf, sizeof(pwdbuf), pwf))
{
- fprintf(stderr, _("%s: could not read password from file \"%s\": %s\n"),
- progname, pwfilename, strerror(errno));
+ if (ferror(pwf))
+ fprintf(stderr, _("%s: could not read password from file \"%s\": %s\n"),
+ progname, pwfilename, strerror(errno));
+ else
+ fprintf(stderr, _("%s: password file \"%s\" is empty\n"),
+ progname, pwfilename);
exit_nicely();
}
fclose(pwf);
[parent: e6550626ca8e]