[libgrss] src: Fix check for return value from socket()
- From: Philip Withnall <pwithnall src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libgrss] src: Fix check for return value from socket()
- Date: Thu, 16 Feb 2017 20:21:11 +0000 (UTC)
commit f47bef47dee12b6d0254d93bc427c6e7ec8b6025
Author: Philip Withnall <withnall endlessm com>
Date: Wed Dec 21 16:53:11 2016 +0000
src: Fix check for return value from socket()
Failure is indicated by a negative number, not by 0. 0 is a valid FD,
although it’s normally used by stdio.
Coverity ID: 1388549
https://bugzilla.gnome.org/show_bug.cgi?id=776115
src/utils.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
---
diff --git a/src/utils.c b/src/utils.c
index 354c743..70f33c3 100644
--- a/src/utils.c
+++ b/src/utils.c
@@ -559,7 +559,7 @@ detect_internet_address ()
return NULL;
sockfd = socket (AF_INET, SOCK_DGRAM, 0);
- if (!sockfd)
+ if (sockfd < 0)
return NULL;
if (connect (sockfd, (struct sockaddr*) &serv_add, sizeof (serv_add)) == -1) {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]