@@ -98,7 +98,7 @@ parseCommandLine(int argc, char *argv[])
98
98
pg_fatal ("%s: cannot be run as root\n" , os_info .progname );
99
99
100
100
if ((log_opts .internal = fopen_priv (INTERNAL_LOG_FILE , "a" )) == NULL )
101
- pg_fatal ("cannot write to log file %s \n" , INTERNAL_LOG_FILE );
101
+ pg_fatal ("could not write to log file \"%s\" \n" , INTERNAL_LOG_FILE );
102
102
103
103
while ((option = getopt_long (argc , argv , "d:D:b:B:cj:ko:O:p:P:rU:v" ,
104
104
long_options , & optindex )) != -1 )
@@ -214,7 +214,7 @@ parseCommandLine(int argc, char *argv[])
214
214
for (filename = output_files ; * filename != NULL ; filename ++ )
215
215
{
216
216
if ((fp = fopen_priv (* filename , "a" )) == NULL )
217
- pg_fatal ("cannot write to log file %s \n" , * filename );
217
+ pg_fatal ("could not write to log file \"%s\" \n" , * filename );
218
218
219
219
/* Start with newline because we might be appending to a file. */
220
220
fprintf (fp , "\n"
@@ -262,7 +262,7 @@ parseCommandLine(int argc, char *argv[])
262
262
canonicalize_path (new_cluster_pgdata );
263
263
264
264
if (!getcwd (cwd , MAXPGPATH ))
265
- pg_fatal ("cannot find current directory\n" );
265
+ pg_fatal ("could not determine current directory\n" );
266
266
canonicalize_path (cwd );
267
267
if (path_is_prefix_of_path (new_cluster_pgdata , cwd ))
268
268
pg_fatal ("cannot run pg_upgrade from inside the new cluster data directory on Windows\n" );
@@ -459,7 +459,7 @@ get_sock_dir(ClusterInfo *cluster, bool live_check)
459
459
/* Use the current directory for the socket */
460
460
cluster -> sockdir = pg_malloc (MAXPGPATH );
461
461
if (!getcwd (cluster -> sockdir , MAXPGPATH ))
462
- pg_fatal ("cannot find current directory\n" );
462
+ pg_fatal ("could not determine current directory\n" );
463
463
}
464
464
else
465
465
{
@@ -477,14 +477,16 @@ get_sock_dir(ClusterInfo *cluster, bool live_check)
477
477
snprintf (filename , sizeof (filename ), "%s/postmaster.pid" ,
478
478
cluster -> pgdata );
479
479
if ((fp = fopen (filename , "r" )) == NULL )
480
- pg_fatal ("Cannot open file %s: %m\n" , filename );
480
+ pg_fatal ("could not open file \"%s\": %s\n" ,
481
+ filename , strerror (errno ));
481
482
482
483
for (lineno = 1 ;
483
484
lineno <= Max (LOCK_FILE_LINE_PORT , LOCK_FILE_LINE_SOCKET_DIR );
484
485
lineno ++ )
485
486
{
486
487
if (fgets (line , sizeof (line ), fp ) == NULL )
487
- pg_fatal ("Cannot read line %d from %s: %m\n" , lineno , filename );
488
+ pg_fatal ("could not read line %d from file \"%s\": %s\n" ,
489
+ lineno , filename , strerror (errno ));
488
490
489
491
/* potentially overwrite user-supplied value */
490
492
if (lineno == LOCK_FILE_LINE_PORT )
@@ -501,7 +503,7 @@ get_sock_dir(ClusterInfo *cluster, bool live_check)
501
503
502
504
/* warn of port number correction */
503
505
if (orig_port != DEF_PGUPORT && old_cluster .port != orig_port )
504
- pg_log (PG_WARNING , "User -supplied old port number %hu corrected to %hu\n" ,
506
+ pg_log (PG_WARNING , "user -supplied old port number %hu corrected to %hu\n" ,
505
507
orig_port , cluster -> port );
506
508
}
507
509
}
0 commit comments