@@ -256,25 +256,24 @@ get_pgpid(bool is_status_request)
256
256
if (stat (pg_data ,& statbuf )!= 0 )
257
257
{
258
258
if (errno == ENOENT )
259
- printf (_ ("%s: directory \"%s\" does not exist\n" ),progname ,
260
- pg_data );
259
+ write_stderr (_ ("%s: directory \"%s\" does not exist\n" ),progname ,
260
+ pg_data );
261
261
else
262
- printf (_ ("%s:cannot access directory \"%s\"\n" ),progname ,
263
- pg_data );
262
+ write_stderr (_ ("%s:could not access directory \"%s\": %s \n" ),progname ,
263
+ pg_data , strerror ( errno ) );
264
264
265
265
/*
266
266
* The Linux Standard Base Core Specification 3.1 says this should
267
267
* return '4, program or service status is unknown'
268
- * https://refspecs.linuxbase.org/LSB_3.1.0/LSB-Core-generic/LSB-Core-g
269
- * eneric/iniscrptact.html
268
+ * https://refspecs.linuxbase.org/LSB_3.1.0/LSB-Core-generic/LSB-Core-generic/iniscrptact.html
270
269
*/
271
270
exit (is_status_request ?4 :1 );
272
271
}
273
272
274
273
if (stat (version_file ,& statbuf )!= 0 && errno == ENOENT )
275
274
{
276
- printf (_ ("%s: directory \"%s\" is not a database cluster directory\n" ),
277
- progname ,pg_data );
275
+ write_stderr (_ ("%s: directory \"%s\" is not a database cluster directory\n" ),
276
+ progname ,pg_data );
278
277
exit (is_status_request ?4 :1 );
279
278
}
280
279