@@ -92,7 +92,10 @@ thread_wdctl(void *arg)
92
92
93
93
94
94
debug (LOG_DEBUG , "Creating socket" );
95
- wdctl_socket_server = socket (PF_UNIX , SOCK_STREAM , 0 );
95
+ if (-1 == (wdctl_socket_server = socket (PF_UNIX , SOCK_STREAM , 0 ))) {
96
+ debug (LOG_ERR , "Could not created wdctl socket (%s)" , strerror (errno ));
97
+ exit (1 );
98
+ }
96
99
97
100
debug (LOG_DEBUG , "Got server socket %d" , wdctl_socket_server );
98
101
@@ -283,7 +286,10 @@ wdctl_restart(int afd)
283
286
}
284
287
285
288
debug (LOG_DEBUG , "Creating socket" );
286
- sock = socket (PF_UNIX , SOCK_STREAM , 0 );
289
+ if (-1 == (sock = socket (PF_UNIX , SOCK_STREAM , 0 ))) {
290
+ debug (LOG_ERR , "Could not created wdctl socket (%s)" , strerror (errno ));
291
+ exit (1 );
292
+ }
287
293
288
294
debug (LOG_DEBUG , "Got internal socket %d" , sock );
289
295
@@ -297,7 +303,7 @@ wdctl_restart(int afd)
297
303
debug (LOG_DEBUG , "Binding socket (%s) (%d)" , sa_un .sun_path , strlen (sock_name ));
298
304
299
305
/* Which to use, AF_UNIX, PF_UNIX, AF_LOCAL, PF_LOCAL? */
300
- if (-1 == bind (wdctl_socket_server , (struct sockaddr * )& sa_un , sizeof (struct sockaddr_un ))) {
306
+ if (-1 == bind (sock , (struct sockaddr * )& sa_un , sizeof (struct sockaddr_un ))) {
301
307
debug (LOG_ERR , "Could not bind internal socket: %s" , strerror (errno ));
302
308
return ;
303
309
}
0 commit comments