aboutgitcodebugslistschat
path: root/qrap.c
diff options
context:
space:
mode:
authorStefano Brivio <sbrivio@redhat.com>2022-04-05 07:10:30 +0200
committerStefano Brivio <sbrivio@redhat.com>2022-04-07 11:44:35 +0200
commit22ed4467a413961816f317c641e436ca627d06d2 (patch)
tree137ea525b0dee2f196e43faa1eeff585746fce2b /qrap.c
parent6a3f6df865cc8b9626181c87b33b4f7723852a2f (diff)
downloadpasst-22ed4467a413961816f317c641e436ca627d06d2.tar
passt-22ed4467a413961816f317c641e436ca627d06d2.tar.gz
passt-22ed4467a413961816f317c641e436ca627d06d2.tar.bz2
passt-22ed4467a413961816f317c641e436ca627d06d2.tar.lz
passt-22ed4467a413961816f317c641e436ca627d06d2.tar.xz
passt-22ed4467a413961816f317c641e436ca627d06d2.tar.zst
passt-22ed4467a413961816f317c641e436ca627d06d2.zip
treewide: Unchecked return value from library, CWE-252
All instances were harmless, but it might be useful to have some debug messages here and there. Reported by Coverity. Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
Diffstat (limited to 'qrap.c')
-rw-r--r--qrap.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/qrap.c b/qrap.c
index 3ee73a7..50eea89 100644
--- a/qrap.c
+++ b/qrap.c
@@ -234,8 +234,10 @@ int main(int argc, char **argv)
valid_args:
for (i = 1; i < UNIX_SOCK_MAX; i++) {
s = socket(AF_UNIX, SOCK_STREAM, 0);
- setsockopt(s, SOL_SOCKET, SO_RCVTIMEO, &tv, sizeof(tv));
- setsockopt(s, SOL_SOCKET, SO_SNDTIMEO, &tv, sizeof(tv));
+ if (setsockopt(s, SOL_SOCKET, SO_RCVTIMEO, &tv, sizeof(tv)))
+ perror("setsockopt SO_RCVTIMEO");
+ if (setsockopt(s, SOL_SOCKET, SO_SNDTIMEO, &tv, sizeof(tv)))
+ perror("setsockopt SO_SNDTIMEO");
if (s < 0) {
perror("socket");
@@ -263,8 +265,11 @@ valid_args:
}
tv.tv_usec = 0;
- setsockopt(s, SOL_SOCKET, SO_RCVTIMEO, &tv, sizeof(tv));
- setsockopt(s, SOL_SOCKET, SO_SNDTIMEO, &tv, sizeof(tv));
+ if (setsockopt(s, SOL_SOCKET, SO_RCVTIMEO, &tv, sizeof(tv)))
+ perror("setsockopt, SO_RCVTIMEO reset");
+ if (setsockopt(s, SOL_SOCKET, SO_SNDTIMEO, &tv, sizeof(tv)))
+ perror("setsockopt, SO_SNDTIMEO reset");
+
fprintf(stderr, "Connected to %s\n", addr.sun_path);
if (dup2(s, (int)fd) < 0) {