@@ -254,8 +254,8 @@ get_pgpid(bool is_status_request)
254254 write_stderr (_ ("%s: directory \"%s\" does not exist\n" ), progname ,
255255 pg_data );
256256 else
257- write_stderr (_ ("%s: could not access directory \"%s\": %s \n" ), progname ,
258- pg_data , strerror ( errno ) );
257+ write_stderr (_ ("%s: could not access directory \"%s\": %m \n" ), progname ,
258+ pg_data );
259259
260260 /*
261261 * The Linux Standard Base Core Specification 3.1 says this should
@@ -280,8 +280,8 @@ get_pgpid(bool is_status_request)
280280 return 0 ;
281281 else
282282 {
283- write_stderr (_ ("%s: could not open PID file \"%s\": %s \n" ),
284- progname , pid_file , strerror ( errno ) );
283+ write_stderr (_ ("%s: could not open PID file \"%s\": %m \n" ),
284+ progname , pid_file );
285285 exit (1 );
286286 }
287287 }
@@ -454,8 +454,8 @@ start_postmaster(void)
454454 if (pm_pid < 0 )
455455 {
456456 /* fork failed */
457- write_stderr (_ ("%s: could not start server: %s \n" ),
458- progname , strerror ( errno ) );
457+ write_stderr (_ ("%s: could not start server: %m \n" ),
458+ progname );
459459 exit (1 );
460460 }
461461 if (pm_pid > 0 )
@@ -474,8 +474,8 @@ start_postmaster(void)
474474#ifdef HAVE_SETSID
475475 if (setsid () < 0 )
476476 {
477- write_stderr (_ ("%s: could not start server due to setsid() failure: %s \n" ),
478- progname , strerror ( errno ) );
477+ write_stderr (_ ("%s: could not start server due to setsid() failure: %m \n" ),
478+ progname );
479479 exit (1 );
480480 }
481481#endif
@@ -496,8 +496,8 @@ start_postmaster(void)
496496 (void ) execl ("/bin/sh" , "/bin/sh" , "-c" , cmd , (char * ) NULL );
497497
498498 /* exec failed */
499- write_stderr (_ ("%s: could not start server: %s \n" ),
500- progname , strerror ( errno ) );
499+ write_stderr (_ ("%s: could not start server: %m \n" ),
500+ progname );
501501 exit (1 );
502502
503503 return 0 ; /* keep dumb compilers quiet */
@@ -544,8 +544,8 @@ start_postmaster(void)
544544 */
545545 if (errno != ENOENT )
546546 {
547- write_stderr (_ ("%s: could not open log file \"%s\": %s \n" ),
548- progname , log_file , strerror ( errno ) );
547+ write_stderr (_ ("%s: could not open log file \"%s\": %m \n" ),
548+ progname , log_file );
549549 exit (1 );
550550 }
551551 }
@@ -851,8 +851,8 @@ trap_sigint_during_startup(SIGNAL_ARGS)
851851 if (postmasterPID != -1 )
852852 {
853853 if (kill (postmasterPID , SIGINT ) != 0 )
854- write_stderr (_ ("%s: could not send stop signal (PID: %d): %s \n" ),
855- progname , (int ) postmasterPID , strerror ( errno ) );
854+ write_stderr (_ ("%s: could not send stop signal (PID: %d): %m \n" ),
855+ progname , (int ) postmasterPID );
856856 }
857857
858858 /*
@@ -1035,8 +1035,7 @@ do_stop(void)
10351035
10361036 if (kill (pid , sig ) != 0 )
10371037 {
1038- write_stderr (_ ("%s: could not send stop signal (PID: %d): %s\n" ), progname , (int ) pid ,
1039- strerror (errno ));
1038+ write_stderr (_ ("%s: could not send stop signal (PID: %d): %m\n" ), progname , (int ) pid );
10401039 exit (1 );
10411040 }
10421041
@@ -1103,8 +1102,7 @@ do_restart(void)
11031102 {
11041103 if (kill (pid , sig ) != 0 )
11051104 {
1106- write_stderr (_ ("%s: could not send stop signal (PID: %d): %s\n" ), progname , (int ) pid ,
1107- strerror (errno ));
1105+ write_stderr (_ ("%s: could not send stop signal (PID: %d): %m\n" ), progname , (int ) pid );
11081106 exit (1 );
11091107 }
11101108
@@ -1159,8 +1157,8 @@ do_reload(void)
11591157
11601158 if (kill (pid , sig ) != 0 )
11611159 {
1162- write_stderr (_ ("%s: could not send reload signal (PID: %d): %s \n" ),
1163- progname , (int ) pid , strerror ( errno ) );
1160+ write_stderr (_ ("%s: could not send reload signal (PID: %d): %m \n" ),
1161+ progname , (int ) pid );
11641162 exit (1 );
11651163 }
11661164
@@ -1207,25 +1205,25 @@ do_promote(void)
12071205
12081206 if ((prmfile = fopen (promote_file , "w" )) == NULL )
12091207 {
1210- write_stderr (_ ("%s: could not create promote signal file \"%s\": %s \n" ),
1211- progname , promote_file , strerror ( errno ) );
1208+ write_stderr (_ ("%s: could not create promote signal file \"%s\": %m \n" ),
1209+ progname , promote_file );
12121210 exit (1 );
12131211 }
12141212 if (fclose (prmfile ))
12151213 {
1216- write_stderr (_ ("%s: could not write promote signal file \"%s\": %s \n" ),
1217- progname , promote_file , strerror ( errno ) );
1214+ write_stderr (_ ("%s: could not write promote signal file \"%s\": %m \n" ),
1215+ progname , promote_file );
12181216 exit (1 );
12191217 }
12201218
12211219 sig = SIGUSR1 ;
12221220 if (kill (pid , sig ) != 0 )
12231221 {
1224- write_stderr (_ ("%s: could not send promote signal (PID: %d): %s \n" ),
1225- progname , (int ) pid , strerror ( errno ) );
1222+ write_stderr (_ ("%s: could not send promote signal (PID: %d): %m \n" ),
1223+ progname , (int ) pid );
12261224 if (unlink (promote_file ) != 0 )
1227- write_stderr (_ ("%s: could not remove promote signal file \"%s\": %s \n" ),
1228- progname , promote_file , strerror ( errno ) );
1225+ write_stderr (_ ("%s: could not remove promote signal file \"%s\": %m \n" ),
1226+ progname , promote_file );
12291227 exit (1 );
12301228 }
12311229
@@ -1280,25 +1278,25 @@ do_logrotate(void)
12801278
12811279 if ((logrotatefile = fopen (logrotate_file , "w" )) == NULL )
12821280 {
1283- write_stderr (_ ("%s: could not create log rotation signal file \"%s\": %s \n" ),
1284- progname , logrotate_file , strerror ( errno ) );
1281+ write_stderr (_ ("%s: could not create log rotation signal file \"%s\": %m \n" ),
1282+ progname , logrotate_file );
12851283 exit (1 );
12861284 }
12871285 if (fclose (logrotatefile ))
12881286 {
1289- write_stderr (_ ("%s: could not write log rotation signal file \"%s\": %s \n" ),
1290- progname , logrotate_file , strerror ( errno ) );
1287+ write_stderr (_ ("%s: could not write log rotation signal file \"%s\": %m \n" ),
1288+ progname , logrotate_file );
12911289 exit (1 );
12921290 }
12931291
12941292 sig = SIGUSR1 ;
12951293 if (kill (pid , sig ) != 0 )
12961294 {
1297- write_stderr (_ ("%s: could not send log rotation signal (PID: %d): %s \n" ),
1298- progname , (int ) pid , strerror ( errno ) );
1295+ write_stderr (_ ("%s: could not send log rotation signal (PID: %d): %m \n" ),
1296+ progname , (int ) pid );
12991297 if (unlink (logrotate_file ) != 0 )
1300- write_stderr (_ ("%s: could not remove log rotation signal file \"%s\": %s \n" ),
1301- progname , logrotate_file , strerror ( errno ) );
1298+ write_stderr (_ ("%s: could not remove log rotation signal file \"%s\": %m \n" ),
1299+ progname , logrotate_file );
13021300 exit (1 );
13031301 }
13041302
@@ -1396,8 +1394,8 @@ do_kill(pid_t pid)
13961394{
13971395 if (kill (pid , sig ) != 0 )
13981396 {
1399- write_stderr (_ ("%s: could not send signal %d (PID: %d): %s \n" ),
1400- progname , sig , (int ) pid , strerror ( errno ) );
1397+ write_stderr (_ ("%s: could not send signal %d (PID: %d): %m \n" ),
1398+ progname , sig , (int ) pid );
14011399 exit (1 );
14021400 }
14031401}
0 commit comments