Skip to content

Commit

Permalink
util: print all errors in a log
Browse files Browse the repository at this point in the history
CID 154076 (#1 of 1): Unchecked return value from library (CHECKED_RETURN)
1. check_return: Calling setsockopt(sk, 6, 1, &val, 4U) without checking return value. This library function may fail and return an error code.

Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
  • Loading branch information
avagin committed Mar 2, 2018
1 parent 5f94389 commit 7a5d310
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions criu/util.c
Original file line number Diff line number Diff line change
Expand Up @@ -1143,13 +1143,15 @@ const char *ns_to_string(unsigned int ns)
void tcp_cork(int sk, bool on)
{
int val = on ? 1 : 0;
setsockopt(sk, SOL_TCP, TCP_CORK, &val, sizeof(val));
if (setsockopt(sk, SOL_TCP, TCP_CORK, &val, sizeof(val)))
pr_perror("Unable to restore TCP_CORK (%d)", val);
}

void tcp_nodelay(int sk, bool on)
{
int val = on ? 1 : 0;
setsockopt(sk, SOL_TCP, TCP_NODELAY, &val, sizeof(val));
if (setsockopt(sk, SOL_TCP, TCP_NODELAY, &val, sizeof(val)))
pr_perror("Unable to restore TCP_NODELAY (%d)", val);
}

static inline void pr_xsym(unsigned char *data, size_t len, int pos)
Expand Down

0 comments on commit 7a5d310

Please sign in to comment.