@@ -254,8 +254,8 @@ get_pgpid(bool is_status_request)
254
254
write_stderr (_ ("%s: directory \"%s\" does not exist\n" ), progname ,
255
255
pg_data );
256
256
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 );
259
259
260
260
/*
261
261
* The Linux Standard Base Core Specification 3.1 says this should
@@ -280,8 +280,8 @@ get_pgpid(bool is_status_request)
280
280
return 0 ;
281
281
else
282
282
{
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 );
285
285
exit (1 );
286
286
}
287
287
}
@@ -454,8 +454,8 @@ start_postmaster(void)
454
454
if (pm_pid < 0 )
455
455
{
456
456
/* 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 );
459
459
exit (1 );
460
460
}
461
461
if (pm_pid > 0 )
@@ -474,8 +474,8 @@ start_postmaster(void)
474
474
#ifdef HAVE_SETSID
475
475
if (setsid () < 0 )
476
476
{
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 );
479
479
exit (1 );
480
480
}
481
481
#endif
@@ -496,8 +496,8 @@ start_postmaster(void)
496
496
(void ) execl ("/bin/sh" , "/bin/sh" , "-c" , cmd , (char * ) NULL );
497
497
498
498
/* 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 );
501
501
exit (1 );
502
502
503
503
return 0 ; /* keep dumb compilers quiet */
@@ -544,8 +544,8 @@ start_postmaster(void)
544
544
*/
545
545
if (errno != ENOENT )
546
546
{
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 );
549
549
exit (1 );
550
550
}
551
551
}
@@ -851,8 +851,8 @@ trap_sigint_during_startup(SIGNAL_ARGS)
851
851
if (postmasterPID != -1 )
852
852
{
853
853
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 );
856
856
}
857
857
858
858
/*
@@ -1035,8 +1035,7 @@ do_stop(void)
1035
1035
1036
1036
if (kill (pid , sig ) != 0 )
1037
1037
{
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 );
1040
1039
exit (1 );
1041
1040
}
1042
1041
@@ -1103,8 +1102,7 @@ do_restart(void)
1103
1102
{
1104
1103
if (kill (pid , sig ) != 0 )
1105
1104
{
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 );
1108
1106
exit (1 );
1109
1107
}
1110
1108
@@ -1159,8 +1157,8 @@ do_reload(void)
1159
1157
1160
1158
if (kill (pid , sig ) != 0 )
1161
1159
{
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 );
1164
1162
exit (1 );
1165
1163
}
1166
1164
@@ -1207,25 +1205,25 @@ do_promote(void)
1207
1205
1208
1206
if ((prmfile = fopen (promote_file , "w" )) == NULL )
1209
1207
{
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 );
1212
1210
exit (1 );
1213
1211
}
1214
1212
if (fclose (prmfile ))
1215
1213
{
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 );
1218
1216
exit (1 );
1219
1217
}
1220
1218
1221
1219
sig = SIGUSR1 ;
1222
1220
if (kill (pid , sig ) != 0 )
1223
1221
{
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 );
1226
1224
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 );
1229
1227
exit (1 );
1230
1228
}
1231
1229
@@ -1280,25 +1278,25 @@ do_logrotate(void)
1280
1278
1281
1279
if ((logrotatefile = fopen (logrotate_file , "w" )) == NULL )
1282
1280
{
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 );
1285
1283
exit (1 );
1286
1284
}
1287
1285
if (fclose (logrotatefile ))
1288
1286
{
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 );
1291
1289
exit (1 );
1292
1290
}
1293
1291
1294
1292
sig = SIGUSR1 ;
1295
1293
if (kill (pid , sig ) != 0 )
1296
1294
{
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 );
1299
1297
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 );
1302
1300
exit (1 );
1303
1301
}
1304
1302
@@ -1396,8 +1394,8 @@ do_kill(pid_t pid)
1396
1394
{
1397
1395
if (kill (pid , sig ) != 0 )
1398
1396
{
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 );
1401
1399
exit (1 );
1402
1400
}
1403
1401
}
0 commit comments