diff options
author | Heikki Linnakangas <heikki.linnakangas@iki.fi> | 2014-12-05 14:27:56 +0200 |
---|---|---|
committer | Heikki Linnakangas <heikki.linnakangas@iki.fi> | 2014-12-05 14:31:54 +0200 |
commit | eadd80c08ddfc485db84b9af7cca54a0d50ebe6d (patch) | |
tree | b938fcb582d4f82d8821cc0ad2d63b7284669bb3 | |
parent | 463dde8def8befec1e8f1f3c106c1ce1108ad54f (diff) | |
download | postgresql-eadd80c08ddfc485db84b9af7cca54a0d50ebe6d.tar.gz postgresql-eadd80c08ddfc485db84b9af7cca54a0d50ebe6d.zip |
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.
-rw-r--r-- | src/bin/initdb/initdb.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/bin/initdb/initdb.c b/src/bin/initdb/initdb.c index 874775577a4..1366174a5ec 100644 --- a/src/bin/initdb/initdb.c +++ b/src/bin/initdb/initdb.c @@ -1656,8 +1656,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); |