diff options
| author | Heikki Linnakangas | 2014-12-05 12:27:56 +0000 |
|---|---|---|
| committer | Heikki Linnakangas | 2014-12-05 12:30:31 +0000 |
| commit | 198cbe0a0c4b539c9f9f3f2e9169d774d1d39a8e (patch) | |
| tree | 660a9c48cf5ac8542033910f7597e6d147832d9e | |
| parent | c0f279c469c87a010fda19647c5453baa5ba97ee (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.
| -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 ed082409b72..3ca4f054b51 100644 --- a/src/bin/initdb/initdb.c +++ b/src/bin/initdb/initdb.c @@ -1663,8 +1663,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); |
