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

Commitcf2c7a7

Browse files
committed
Detect format-string mistakes in the libpq_pipeline test module.
I happened to notice that libpq_pipeline's private implementationof pg_fatal lacked any pg_attribute_printf decoration. Indeed,adding that turned up a mistake! We'd likely never have noticedbecause the error exits in this code are unlikely to get hit,but still, it's a bug.We're so used to having the compiler check this stuff for us thata printf-like function without pg_attribute_printf is a land mine.I wonder if there is a way to detect such omissions.Back-patch to v14 where this code came in.
1 parent3a06a79 commitcf2c7a7

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

‎src/test/modules/libpq_pipeline/libpq_pipeline.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@
2626

2727

2828
staticvoidexit_nicely(PGconn*conn);
29+
staticvoidpg_attribute_noreturn()pg_fatal_impl(intline,constchar*fmt,...)
30+
pg_attribute_printf(2,3);
2931
staticboolprocess_result(PGconn*conn,PGresult*res,intresults,
3032
intnumsent);
3133

@@ -914,7 +916,7 @@ test_prepared(PGconn *conn)
914916
if (PQresultStatus(res)!=PGRES_COMMAND_OK)
915917
pg_fatal("expected COMMAND_OK, got %s",PQresStatus(PQresultStatus(res)));
916918
if (PQnfields(res)!=lengthof(expected_oids))
917-
pg_fatal("expected %d columns, got %d",
919+
pg_fatal("expected %zd columns, got %d",
918920
lengthof(expected_oids),PQnfields(res));
919921
for (inti=0;i<PQnfields(res);i++)
920922
{

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp