aboutgitcodebugslistschat
path: root/qrap.c
diff options
context:
space:
mode:
authorStefano Brivio <sbrivio@redhat.com>2022-04-05 11:51:47 +0200
committerStefano Brivio <sbrivio@redhat.com>2022-04-07 11:44:35 +0200
commiteb3d3f367ea09b89d54f177ded1e874611d1020f (patch)
tree31fea867bba5f73506352c8a1188fa1309669cd2 /qrap.c
parentbb76470090dc21540e70c3417fe0227c5a62cce2 (diff)
downloadpasst-eb3d3f367ea09b89d54f177ded1e874611d1020f.tar
passt-eb3d3f367ea09b89d54f177ded1e874611d1020f.tar.gz
passt-eb3d3f367ea09b89d54f177ded1e874611d1020f.tar.bz2
passt-eb3d3f367ea09b89d54f177ded1e874611d1020f.tar.lz
passt-eb3d3f367ea09b89d54f177ded1e874611d1020f.tar.xz
passt-eb3d3f367ea09b89d54f177ded1e874611d1020f.tar.zst
passt-eb3d3f367ea09b89d54f177ded1e874611d1020f.zip
treewide: Argument cannot be negative, CWE-687
Actually harmless. Reported by Coverity. Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
Diffstat (limited to 'qrap.c')
-rw-r--r--qrap.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/qrap.c b/qrap.c
index 50eea89..17cc472 100644
--- a/qrap.c
+++ b/qrap.c
@@ -234,16 +234,16 @@ int main(int argc, char **argv)
valid_args:
for (i = 1; i < UNIX_SOCK_MAX; i++) {
s = socket(AF_UNIX, SOCK_STREAM, 0);
- 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");
exit(EXIT_FAILURE);
}
+ 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");
+
snprintf(addr.sun_path, UNIX_PATH_MAX, UNIX_SOCK_PATH, i);
if (connect(s, (const struct sockaddr *)&addr, sizeof(addr)))
perror("connect");