Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitcce64a5

Browse files
committed
Replace use of strerror() with %s by %m in pg_waldump
Sinced6c55de, src/port/snprintf.c is able to use %m instead ofstrerror(). A couple of utilities in src/bin/ have already done theswitch, and do it now for pg_waldump as this reduces the workload fortranslators.Note that more could be done, particularly with pgbench. Thanks toKyotaro Horiguchi for the discussion.Discussion:https://postgr.es/m/20191129065115.GM2505@paquier.xyz
1 parente69d644 commitcce64a5

File tree

1 file changed

+6
-9
lines changed

1 file changed

+6
-9
lines changed

‎src/bin/pg_waldump/pg_waldump.c‎

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -142,8 +142,7 @@ open_file_in_directory(const char *directory, const char *fname)
142142
fd=open(fpath,O_RDONLY |PG_BINARY,0);
143143

144144
if (fd<0&&errno!=ENOENT)
145-
fatal_error("could not open file \"%s\": %s",
146-
fname,strerror(errno));
145+
fatal_error("could not open file \"%s\": %m",fname);
147146
returnfd;
148147
}
149148

@@ -207,8 +206,8 @@ search_directory(const char *directory, const char *fname)
207206
else
208207
{
209208
if (errno!=0)
210-
fatal_error("could not read file \"%s\": %s",
211-
fname,strerror(errno));
209+
fatal_error("could not read file \"%s\": %m",
210+
fname);
212211
else
213212
fatal_error("could not read file \"%s\": read %d of %zu",
214213
fname,r, (Size)XLOG_BLCKSZ);
@@ -316,7 +315,7 @@ WALDumpOpenSegment(XLogSegNo nextSegNo, WALSegmentContext *segcxt,
316315
break;
317316
}
318317

319-
fatal_error("could not find file \"%s\": %s",fname,strerror(errno));
318+
fatal_error("could not find file \"%s\": %m",fname);
320319
return-1;/* keep compiler quiet */
321320
}
322321

@@ -925,8 +924,7 @@ main(int argc, char **argv)
925924
/* validate path points to directory */
926925
if (!verify_directory(waldir))
927926
{
928-
pg_log_error("path \"%s\" could not be opened: %s",
929-
waldir,strerror(errno));
927+
pg_log_error("could not open directory \"%s\": %m",waldir);
930928
gotobad_argument;
931929
}
932930
}
@@ -946,8 +944,7 @@ main(int argc, char **argv)
946944
waldir=directory;
947945

948946
if (!verify_directory(waldir))
949-
fatal_error("could not open directory \"%s\": %s",
950-
waldir,strerror(errno));
947+
fatal_error("could not open directory \"%s\": %m",waldir);
951948
}
952949

953950
waldir=identify_target_directory(waldir,fname);

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp