@@ -98,7 +98,7 @@ parseCommandLine(int argc, char *argv[])
9898 pg_fatal ("%s: cannot be run as root\n" , os_info .progname );
9999
100100 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 );
102102
103103 while ((option = getopt_long (argc , argv , "d:D:b:B:cj:ko:O:p:P:rU:v" ,
104104 long_options , & optindex )) != -1 )
@@ -214,7 +214,7 @@ parseCommandLine(int argc, char *argv[])
214214 for (filename = output_files ; * filename != NULL ; filename ++ )
215215 {
216216 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 );
218218
219219 /* Start with newline because we might be appending to a file. */
220220 fprintf (fp , "\n"
@@ -262,7 +262,7 @@ parseCommandLine(int argc, char *argv[])
262262 canonicalize_path (new_cluster_pgdata );
263263
264264 if (!getcwd (cwd , MAXPGPATH ))
265- pg_fatal ("cannot find current directory\n" );
265+ pg_fatal ("could not determine current directory\n" );
266266 canonicalize_path (cwd );
267267 if (path_is_prefix_of_path (new_cluster_pgdata , cwd ))
268268 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)
459459 /* Use the current directory for the socket */
460460 cluster -> sockdir = pg_malloc (MAXPGPATH );
461461 if (!getcwd (cluster -> sockdir , MAXPGPATH ))
462- pg_fatal ("cannot find current directory\n" );
462+ pg_fatal ("could not determine current directory\n" );
463463 }
464464 else
465465 {
@@ -477,14 +477,16 @@ get_sock_dir(ClusterInfo *cluster, bool live_check)
477477 snprintf (filename , sizeof (filename ), "%s/postmaster.pid" ,
478478 cluster -> pgdata );
479479 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 ));
481482
482483 for (lineno = 1 ;
483484 lineno <= Max (LOCK_FILE_LINE_PORT , LOCK_FILE_LINE_SOCKET_DIR );
484485 lineno ++ )
485486 {
486487 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 ));
488490
489491 /* potentially overwrite user-supplied value */
490492 if (lineno == LOCK_FILE_LINE_PORT )
@@ -501,7 +503,7 @@ get_sock_dir(ClusterInfo *cluster, bool live_check)
501503
502504 /* warn of port number correction */
503505 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" ,
505507 orig_port , cluster -> port );
506508 }
507509 }
0 commit comments