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

Commitc9bd7f4

Browse files
committed
Improve what pg_strsignal prints if we haven't got strsignal(3).
Turns out that returning "unrecognized signal" is confusing.Make it explicit that the platform lacks any support for signal names.(At least of the machines in the buildfarm, only HPUX lacks it.)Back-patch to v12 where we invented this function.Discussion:https://postgr.es/m/3067.1566870481@sss.pgh.pa.us
1 parentb8b3a27 commitc9bd7f4

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

‎src/port/pgstrsignal.c

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,11 @@
3232
*
3333
* This version guarantees to return a non-NULL pointer, although
3434
* some platforms' versions of strsignal() reputedly do not.
35+
*
36+
* Note that the fallback cases just return constant strings such as
37+
* "unrecognized signal". Project style is for callers to print the
38+
* numeric signal value along with the result of this function, so
39+
* there's no need to work harder than that.
3540
*/
3641
constchar*
3742
pg_strsignal(intsignum)
@@ -43,22 +48,17 @@ pg_strsignal(int signum)
4348
*/
4449
#ifdefHAVE_STRSIGNAL
4550
result=strsignal(signum);
46-
if (result)
47-
returnresult;
51+
if (result==NULL)
52+
result="unrecognized signal";
4853
#else
4954

5055
/*
5156
* We used to have code here to try to use sys_siglist[] if available.
5257
* However, it seems that all platforms with sys_siglist[] have also had
5358
* strsignal() for many years now, so that was just a waste of code.
5459
*/
60+
result="(signal names not available on this platform)";
5561
#endif
5662

57-
/*
58-
* Fallback case: just return "unrecognized signal". Project style is for
59-
* callers to print the numeric signal value along with the result of this
60-
* function, so there's no need to work harder than this.
61-
*/
62-
result="unrecognized signal";
6363
returnresult;
6464
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp