[CRIU] [PATCH 08/18] util: handle errors of setsockopt()
Andrei Vagin
avagin at openvz.org
Thu Nov 9 22:21:02 MSK 2017
From: Andrei Vagin <avagin at virtuozzo.com>
These errors are not critical, so we just prints errors in logs.
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.
CID 154077: Unchecked return value from library (CHECKED_RETURN)
1. check_return: Calling setsockopt(sk, 6, 3, &val, 4U) without checking return value. This library function may fail and return an error code.
Signed-off-by: Andrei Vagin <avagin at virtuozzo.com>
---
criu/util.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/criu/util.c b/criu/util.c
index 5ba49510a..63954355e 100644
--- a/criu/util.c
+++ b/criu/util.c
@@ -1107,13 +1107,17 @@ 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 set TCP_CORK into %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 set TCP_NODELAY into %d", val);
}
static inline void pr_xsym(unsigned char *data, size_t len, int pos)
--
2.13.6
More information about the CRIU
mailing list