[server] setsockopt() nad fcntl() return value checking (found by Coverity)
This commit is contained in:
+6
-1
@@ -621,7 +621,12 @@ write_pid_file(fko_srv_options_t *opts)
|
||||
return -1;
|
||||
}
|
||||
|
||||
fcntl(op_fd, F_SETFD, FD_CLOEXEC);
|
||||
if(fcntl(op_fd, F_SETFD, FD_CLOEXEC) == -1)
|
||||
{
|
||||
close(op_fd);
|
||||
perror("Unexpected error from fcntl: ");
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* Attempt to lock the PID file. If we get an EWOULDBLOCK
|
||||
* error, another instance already has the lock. So we grab
|
||||
|
||||
+6
-1
@@ -108,7 +108,12 @@ run_tcp_server(fko_srv_options_t *opts)
|
||||
|
||||
/* So that we can re-bind to it without TIME_WAIT problems
|
||||
*/
|
||||
setsockopt(s_sock, SOL_SOCKET, SO_REUSEADDR, &reuse_addr, sizeof(reuse_addr));
|
||||
if(setsockopt(s_sock, SOL_SOCKET, SO_REUSEADDR, &reuse_addr, sizeof(reuse_addr)) == -1)
|
||||
{
|
||||
log_msg(LOG_ERR, "run_tcp_server: setsockopt error: %s",
|
||||
strerror(errno));
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
/* Make our main socket non-blocking so we don't have to be stuck on
|
||||
* listening for incoming connections.
|
||||
|
||||
Reference in New Issue
Block a user