[CRIU] [PATCH 3/8] util: print all errors in a log

Andrei Vagin avagin at openvz.org
Fri Feb 16 10:21:15 MSK 2018


[This sender failed our fraud detection checks and may not be who they appear to be. Learn about spoofing at http://aka.ms/LearnAboutSpoofing]

From: Andrei Vagin <avagin at virtuozzo.com>

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 at virtuozzo.com>
---
 criu/util.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/criu/util.c b/criu/util.c
index 41eb15acb..c9d98387d 100644
--- a/criu/util.c
+++ b/criu/util.c
@@ -1182,13 +1182,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)
--
2.13.6




More information about the CRIU mailing list