Commit c424c049 authored by Peter Eisentraut's avatar Peter Eisentraut

pg_ctl: Write error messages to stderr

parent 2dc4f011
...@@ -256,24 +256,23 @@ get_pgpid(bool is_status_request) ...@@ -256,24 +256,23 @@ get_pgpid(bool is_status_request)
if (stat(pg_data, &statbuf) != 0) if (stat(pg_data, &statbuf) != 0)
{ {
if (errno == ENOENT) if (errno == ENOENT)
printf(_("%s: directory \"%s\" does not exist\n"), progname, write_stderr(_("%s: directory \"%s\" does not exist\n"), progname,
pg_data); pg_data);
else else
printf(_("%s: cannot access directory \"%s\"\n"), progname, write_stderr(_("%s: could not access directory \"%s\": %s\n"), progname,
pg_data); pg_data, strerror(errno));
/* /*
* The Linux Standard Base Core Specification 3.1 says this should * The Linux Standard Base Core Specification 3.1 says this should
* return '4, program or service status is unknown' * return '4, program or service status is unknown'
* https://refspecs.linuxbase.org/LSB_3.1.0/LSB-Core-generic/LSB-Core-g * https://refspecs.linuxbase.org/LSB_3.1.0/LSB-Core-generic/LSB-Core-generic/iniscrptact.html
* eneric/iniscrptact.html
*/ */
exit(is_status_request ? 4 : 1); exit(is_status_request ? 4 : 1);
} }
if (stat(version_file, &statbuf) != 0 && errno == ENOENT) if (stat(version_file, &statbuf) != 0 && errno == ENOENT)
{ {
printf(_("%s: directory \"%s\" is not a database cluster directory\n"), write_stderr(_("%s: directory \"%s\" is not a database cluster directory\n"),
progname, pg_data); progname, pg_data);
exit(is_status_request ? 4 : 1); exit(is_status_request ? 4 : 1);
} }
......
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