util/fdlist: fix incorrect close() on stolen FD
Fix fdlist_truncate() after fdlist_steal() to not call into close(2) if
the FD is invalid. Use c_close() to avoid this.
@@ -64,7 +64,7 @@ void fdlist_truncate(FDList *list, size_t n_fds) {
if (list->consumed)
for (i = n_fds; i < n; ++i)
- close(p[i]);
+ c_close(p[i]);
list->cmsg->cmsg_len = CMSG_LEN(n_fds * sizeof(int));
}
