summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarsten Haitzler (Rasterman) <raster@rasterman.com>2020-04-17 12:28:35 +0100
committerCarsten Haitzler (Rasterman) <raster@rasterman.com>2020-04-17 12:28:35 +0100
commit226c1952038a1863de897becfe93095fd96786b4 (patch)
treea56b8ed53a3d910957320cca95bfe8e0f972386e
parent5f93f16b61c34b09f9ce3f1ab7bb8473a81b4d04 (diff)
ecore - examples - fix gnutls fd handler example warnings
just error returns not being checked. not an issue really, but this silences warnings. fix CID 1164185 715896 98094 1400818
-rw-r--r--src/examples/ecore/ecore_fd_handler_gnutls_example.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/examples/ecore/ecore_fd_handler_gnutls_example.c b/src/examples/ecore/ecore_fd_handler_gnutls_example.c
index 30fd6bcce2..de30f02365 100644
--- a/src/examples/ecore/ecore_fd_handler_gnutls_example.c
+++ b/src/examples/ecore/ecore_fd_handler_gnutls_example.c
@@ -18,6 +18,7 @@
18#ifdef HAVE_ARPA_INET_H 18#ifdef HAVE_ARPA_INET_H
19# include <arpa/inet.h> 19# include <arpa/inet.h>
20#endif 20#endif
21#include <stdio.h>
21#include <errno.h> 22#include <errno.h>
22#include <unistd.h> 23#include <unistd.h>
23#include <gnutls/gnutls.h> 24#include <gnutls/gnutls.h>
@@ -100,16 +101,17 @@ tcp_connect(void)
100 101
101 /* sets some fd options such as nonblock */ 102 /* sets some fd options such as nonblock */
102 sd = socket(AF_INET, SOCK_STREAM, 0); 103 sd = socket(AF_INET, SOCK_STREAM, 0);
103 fcntl(sd, F_SETFL, O_NONBLOCK); 104 if (sd < 0) abort();
105 if (fcntl(sd, F_SETFL, O_NONBLOCK) < 0) perror("fcntl");
104 eina_file_close_on_exec(sd, EINA_TRUE); 106 eina_file_close_on_exec(sd, EINA_TRUE);
105 setsockopt(sd, SOL_SOCKET, SO_REUSEADDR, (const void *)&curstate, sizeof(curstate)); 107 if (setsockopt(sd, SOL_SOCKET, SO_REUSEADDR, (const void *)&curstate, sizeof(curstate)) < 0) perror("setsockopt");
106 108
107 setsockopt(sd, IPPROTO_TCP, TCP_NODELAY, (char *)&flag, sizeof(int)); 109 if (setsockopt(sd, IPPROTO_TCP, TCP_NODELAY, (char *)&flag, sizeof(int)) < 0) perror("setsockopt");
108 110
109 memset(&sa, '\0', sizeof (sa)); 111 memset(&sa, '\0', sizeof (sa));
110 sa.sin_family = AF_INET; 112 sa.sin_family = AF_INET;
111 sa.sin_port = eina_htons(atoi(PORT)); 113 sa.sin_port = eina_htons(atoi(PORT));
112 inet_pton(AF_INET, SERVER, &sa.sin_addr); 114 if (inet_pton(AF_INET, SERVER, &sa.sin_addr)) perror("inet_pton");
113 115
114 /* connects to server 116 /* connects to server
115 */ 117 */