#include "system/select.h"
#include "system/time.h"
#include "system/network.h"
-#include "dlinklist.h"
+#include "lib/util/dlinklist.h"
#include "pthreadpool/pthreadpool.h"
#include "lib/util/iov_buf.h"
#include "lib/msghdr.h"
return EINVAL;
}
-#ifndef HAVE_STRUCT_MSGHDR_MSG_CONTROL
+#if !defined(HAVE_STRUCT_MSGHDR_MSG_CONTROL) && !defined(HAVE_STRUCT_MSGHDR_MSG_ACCRIGHTS)
if (num_fds > 0) {
return ENOSYS;
}
-#endif /* ! HAVE_STRUCT_MSGHDR_MSG_CONTROL */
+#endif
for (i = 0; i < num_fds; i++) {
/*
{
uint8_t buf[fdlen];
- msghdr_prep_fds(&msg, buf, 0, fds, num_fds);
+ msghdr_prep_fds(&msg, buf, fdlen, fds, num_fds);
ret = sendmsg(ctx->sock, &msg, 0);
}
ctx->ev_funcs->watch_free(ctx->sock_read_watch);
+ close(ctx->sock);
if (getpid() == ctx->created_pid) {
/* If we created it, unlink. Otherwise someone else might
* still have it open */
unlink(ctx->path);
}
- close(ctx->sock);
free(ctx->recv_buf);
free(ctx);
return 0;
return EINVAL;
}
-#ifndef HAVE_STRUCT_MSGHDR_MSG_CONTROL
- if (num_fds > 0) {
- return ENOSYS;
- }
-#endif /* ! HAVE_STRUCT_MSGHDR_MSG_CONTROL */
-
if (num_fds > INT8_MAX) {
return EINVAL;
}