]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
Handle a failure of strerror_r
authorTravis Cross <tc@traviscross.com>
Sat, 25 May 2013 09:49:32 +0000 (09:49 +0000)
committerTravis Cross <tc@traviscross.com>
Sat, 25 May 2013 21:44:16 +0000 (21:44 +0000)
This fixes the build on gcc-4.7.3.  The build was breaking with:

  error: ignoring return value of 'strerror_r', declared with attribute warn_unused_result [-Werror=unused-result]

libs/esl/src/esl.c

index 103f9156c946d9bbbd3b23269d53a61ae89975e9..af967de708e8b68d3a1b56bc3344c77b177c1820 100644 (file)
@@ -1287,7 +1287,8 @@ ESL_DECLARE(esl_status_t) esl_recv_event(esl_handle_t *handle, int check_q, esl_
                        }
                        continue;
                } else if (rrval < 0) {
-                       strerror_r(handle->errnum, handle->err, sizeof(handle->err));
+                       if (!(strerror_r(handle->errnum, handle->err, sizeof(handle->err))))
+                               *(handle->err)=0;
                        goto fail;
                }
 
@@ -1319,7 +1320,8 @@ ESL_DECLARE(esl_status_t) esl_recv_event(esl_handle_t *handle, int check_q, esl_
                                *((char *)handle->socket_buf + ESL_CLAMP(0, sizeof(handle->socket_buf) - 1, r)) = '\0';
 
                                if (r < 0) {
-                                       strerror_r(handle->errnum, handle->err, sizeof(handle->err));
+                                       if (!(strerror_r(handle->errnum, handle->err, sizeof(handle->err))))
+                                               *(handle->err)=0;
                                        goto fail;
                                } else if (r == 0) {
                                        if (++zc >= 100) {
@@ -1464,14 +1466,16 @@ ESL_DECLARE(esl_status_t) esl_send(esl_handle_t *handle, const char *cmd)
        
        if (send(handle->sock, cmd, strlen(cmd), 0) != (int)strlen(cmd)) {
                handle->connected = 0;
-               strerror_r(handle->errnum, handle->err, sizeof(handle->err));
+               if (!(strerror_r(handle->errnum, handle->err, sizeof(handle->err))))
+                       *(handle->err)=0;
                return ESL_FAIL;
        }
        
        if (!(*e == '\n' && *(e-1) == '\n')) {
                if (send(handle->sock, "\n\n", 2, 0) != 2) {
                        handle->connected = 0;
-                       strerror_r(handle->errnum, handle->err, sizeof(handle->err));
+                       if (!(strerror_r(handle->errnum, handle->err, sizeof(handle->err))))
+                               *(handle->err)=0;
                        return ESL_FAIL;
                }
        }