Use full path to dlinklist.h in includes.
[obnox/samba/samba-obnox.git] / source3 / lib / unix_msg / unix_msg.c
index f2422490e6f7db4a2f1553ae1edd75d7814dcf68..cb648ede97f9e6e77b6851ecb5efbd856901e37e 100644 (file)
@@ -21,7 +21,7 @@
 #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"
@@ -572,11 +572,11 @@ static int unix_dgram_send(struct unix_dgram_ctx *ctx,
                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++) {
                /*
@@ -627,7 +627,7 @@ static int unix_dgram_send(struct unix_dgram_ctx *ctx,
 
        {
                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);
        }
@@ -684,13 +684,13 @@ static int unix_dgram_free(struct unix_dgram_ctx *ctx)
 
        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;
@@ -798,12 +798,6 @@ int unix_msg_send(struct unix_msg_ctx *ctx, const struct sockaddr_un *dst,
                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;
        }