Commit 198cbe0a authored by Heikki Linnakangas's avatar Heikki Linnakangas

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.
parent c0f279c4
...@@ -1663,8 +1663,12 @@ get_set_pwd(void) ...@@ -1663,8 +1663,12 @@ get_set_pwd(void)
} }
if (!fgets(pwdbuf, sizeof(pwdbuf), pwf)) if (!fgets(pwdbuf, sizeof(pwdbuf), pwf))
{ {
if (ferror(pwf))
fprintf(stderr, _("%s: could not read password from file \"%s\": %s\n"), fprintf(stderr, _("%s: could not read password from file \"%s\": %s\n"),
progname, pwfilename, strerror(errno)); progname, pwfilename, strerror(errno));
else
fprintf(stderr, _("%s: password file \"%s\" is empty\n"),
progname, pwfilename);
exit_nicely(); exit_nicely();
} }
fclose(pwf); fclose(pwf);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment