assert(_b);
n = recvmsg(fd, &msghdr, MSG_DONTWAIT);
- if (n <= 0) {
- if (n == 0) {
- log_error("Short read");
- return -EIO;
- }
-
+ if (n < 0) {
if (errno == EAGAIN || errno == EINTR)
return 0;
return -errno;
}
+ cmsg_close_all(&msghdr);
+
+ if (n == 0) {
+ log_error("Short read");
+ return -EIO;
+ }
+
if (msghdr.msg_controllen < CMSG_LEN(sizeof(struct ucred)) ||
control.cmsghdr.cmsg_level != SOL_SOCKET ||
control.cmsghdr.cmsg_type != SCM_CREDENTIALS ||