CID 716847: Other violation (CHECKED_RETURN)
At (5): Calling function "fcntl(sock_fd, 2, 1)" without checking return value. This library function may fail and return an error code.
At (6): No check of the return value of "fcntl(sock_fd, 2, 1)".
Signed-off-by: Sage Weil <sage@inktank.com>
<< "failed to create socket: " << cpp_strerror(err);
return oss.str();
}
- fcntl(sock_fd, F_SETFD, FD_CLOEXEC);
+ int r = fcntl(sock_fd, F_SETFD, FD_CLOEXEC);
+ if (r < 0) {
+ r = errno;
+ ostringstream oss;
+ oss << "AdminSocket::bind_and_listen: failed to fcntl on socket: " << cpp_strerror(r);
+ return oss.str();
+ }
memset(&address, 0, sizeof(struct sockaddr_un));
address.sun_family = AF_UNIX;
snprintf(address.sun_path, sizeof(address.sun_path),