9
0
Fork 0

sctp: Print the rc and the errno in case of an error

Print the errno and RC to give some kind of idea about
the error.
This commit is contained in:
Holger Hans Peter Freyther 2015-08-30 22:50:28 +02:00
parent e3e6944cfe
commit d5be846c92
2 changed files with 6 additions and 2 deletions

View File

@ -31,6 +31,7 @@
#include <string.h>
#include <unistd.h>
#include <errno.h>
#define SCTP_PPID_M2UA 2
@ -582,7 +583,8 @@ static int m2ua_conn_read(struct osmo_fd *fd)
rc = sctp_recvmsg(fd->fd, msg->data, msg->data_len,
(struct sockaddr *) &addr, &len, &info, NULL);
if (rc <= 0) {
LOGP(DINP, LOGL_ERROR, "Failed to read.\n");
LOGP(DINP, LOGL_ERROR, "Failed to read: %d errno: %d\n",
rc, errno);
msgb_free(msg);
m2ua_conn_destroy(fd->data);
return -1;

View File

@ -29,6 +29,7 @@
#include <netinet/sctp.h>
#include <unistd.h>
#include <errno.h>
#define SCTP_PPID_M3UA 3
@ -156,7 +157,8 @@ static int m3ua_conn_read(struct osmo_fd *fd)
rc = sctp_recvmsg(fd->fd, msg->data, msg->data_len,
(struct sockaddr *) &addr, &len, &info, NULL);
if (rc <= 0) {
LOGP(DINP, LOGL_ERROR, "Failed to read.\n");
LOGP(DINP, LOGL_ERROR, "Failed to read: %d errno: %d\n",
rc, errno);
msgb_free(msg);
fail_link(link);
return -1;