mirror of
https://github.com/signalwire/freeswitch.git
synced 2026-10-24 12:14:13 +00:00
FreeSWITCH: Add switch_strerror_r() to fix problems with XSI and GNU variants of strerror_r().
GNU variant of strerror_r() returns char *, while the XSI version returns int.
To make things worse, glibc ships both and added a unused result warning
in recent versions (2.16) causing the build to fail.
Add our own custom wrapper that always returns a pointer to the message buffer
and additionally make XSI versions of strerror_r() GNU compatible by
returning "Unknown error xxx" if no error message is available.
Fixes:
src/switch_rtp.c: In function 'rtp_common_read':
src/switch_rtp.c:3313:15: error: ignoring return value of 'strerror_r',
declared with attribute warn_unused_result [-Werror=unused-result]
cc1: all warnings being treated as errors
Signed-off-by: Stefan Knoblich <stkn@openisdn.net>
This commit is contained in:
1 parent
3d9d42b798
commit
8bcf3b4fb8
4 files changed
+44
-2
No files matched your search
+2
-2
@@ -3310,8 +3310,8 @@ static int rtp_common_read(switch_rtp_t *rtp_session, switch_payload_t *payload_
|
||||
|
||||
if (!SWITCH_STATUS_IS_BREAK(poll_status) && poll_status != SWITCH_STATUS_TIMEOUT) {
|
||||
char tmp[128] = "";
|
||||
strerror_r(poll_status, tmp, sizeof(tmp));
|
||||
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Poll failed with error: %d [%s]\n", poll_status, tmp);
|
||||
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Poll failed with error: %d [%s]\n",
|
||||
poll_status, switch_strerror_r(poll_status, tmp, sizeof(tmp)));
|
||||
ret = -1;
|
||||
goto end;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user