File tree Expand file tree Collapse file tree 1 file changed +9
-0
lines changed Expand file tree Collapse file tree 1 file changed +9
-0
lines changed Original file line number Diff line number Diff line change @@ -123,12 +123,21 @@ void get_clients_from_parent(void) {
123
123
124
124
/* Connect to socket */
125
125
sock = socket (AF_UNIX , SOCK_STREAM , 0 );
126
+ /* XXX An attempt to quieten coverity warning about the subsequent connect call:
127
+ * Coverity says: "sock is apssed to parameter that cannot be negative"
128
+ * Although connect expects a signed int, coverity probably tells us that it shouldn't
129
+ * be negative */
130
+ if (sock < 0 ) {
131
+ debug (LOG_ERR , "Could not open socket (%s) - client list not downloaded" , strerror (errno ));
132
+ return ;
133
+ }
126
134
memset (& sa_un , 0 , sizeof (sa_un ));
127
135
sa_un .sun_family = AF_UNIX ;
128
136
strncpy (sa_un .sun_path , config -> internal_sock , (sizeof (sa_un .sun_path ) - 1 ));
129
137
130
138
if (connect (sock , (struct sockaddr * )& sa_un , strlen (sa_un .sun_path ) + sizeof (sa_un .sun_family ))) {
131
139
debug (LOG_ERR , "Failed to connect to parent (%s) - client list not downloaded" , strerror (errno ));
140
+ close (sock );
132
141
return ;
133
142
}
134
143
You can’t perform that action at this time.
0 commit comments