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:37 +0200 |
commit | 729202754e06fe93b5fbebb1834839d4c60e8d78 (patch) | |
tree | aef915184ad5f7f1c350781aee65b5d50d302b4a /src | |
parent | 2e3cc39556ee2288d9fe4919b5537b6bcb56a6fc (diff) |
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.
Diffstat (limited to 'src')
-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 16fa36bdea7..41368ec8c71 100644 --- a/src/bin/initdb/initdb.c +++ b/src/bin/initdb/initdb.c @@ -1292,8 +1292,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); |