Bug 10849 - source3/lib/unix_msg/unix_msg.c and source3/modules/vfs_aio_fork.c compiling errors on Solaris platform
Summary: source3/lib/unix_msg/unix_msg.c and source3/modules/vfs_aio_fork.c compiling ...
Status: RESOLVED FIXED
Alias: None
Product: Samba 4.1 and newer
Classification: Unclassified
Component: Other (show other bugs)
Version: unspecified
Hardware: All Solaris
: P5 critical (vote)
Target Milestone: ---
Assignee: Karolin Seeger
QA Contact: Samba QA Contact
URL:
Keywords:
Depends on:
Blocks: 10077
  Show dependency treegraph
 
Reported: 2014-10-02 16:43 UTC by YOUZHONG YANG
Modified: 2015-01-28 22:34 UTC (History)
2 users (show)

See Also:


Attachments
Test patch (2.15 KB, patch)
2014-10-02 19:52 UTC, Jeremy Allison
no flags Details
Patch for v4-2-test (3.13 KB, patch)
2015-01-26 13:03 UTC, Stefan Metzmacher
jra: review+
Details

Note You need to log in before you can comment on or make changes to this bug.
Description YOUZHONG YANG 2014-10-02 16:43:00 UTC
On Solaris, HAVE_STRUCT_MSGHDR_MSG_CONTROL is not defined, so source3/lib/unix_msg/unix_msg.c and source3/modules/vfs_aio_fork.c cannot be compiled.

Here are possible fixes, I am sure if they are correct or not:

diff --git a/source3/lib/unix_msg/unix_msg.c b/source3/lib/unix_msg/unix_msg.c
index 4870068..dafc799 100644
--- a/source3/lib/unix_msg/unix_msg.c
+++ b/source3/lib/unix_msg/unix_msg.c
@@ -505,7 +505,9 @@ static int queue_msg(struct unix_dgram_send_queue *q,
 	 * Note: No need to check for overflow here,
 	 * since cmsg will store <= INT8_MAX fds.
 	 */
+#ifdef HAVE_STRUCT_MSGHDR_MSG_CONTROL
 	msglen += cmsg_space;
+#endif
 
 	data_len = iov_buflen(iov, iovlen);
 	if (data_len == -1) {
@@ -593,7 +595,9 @@ static int queue_msg(struct unix_dgram_send_queue *q,
 	return 0;
 
 fail:
+#ifdef HAVE_STRUCT_MSGHDR_MSG_CONTROL
 	close_fd_array(fds_copy, num_fds);
+#endif
 	return ret;
 }
 
diff --git a/source3/modules/vfs_aio_fork.c b/source3/modules/vfs_aio_fork.c
index c1bded9..652a1e3 100644
--- a/source3/modules/vfs_aio_fork.c
+++ b/source3/modules/vfs_aio_fork.c
@@ -173,7 +173,9 @@ static ssize_t read_fd(int fd, void *ptr, size_t nbytes, int *recvfd)
 
 	msg.msg_name = NULL;
 	msg.msg_namelen = 0;
+#ifdef HAVE_STRUCT_MSGHDR_MSG_CONTROL
 	msg.msg_flags = 0;
+#endif
 
 	iov[0].iov_base = (void *)ptr;
 	iov[0].iov_len = nbytes;
Comment 1 Jeremy Allison 2014-10-02 19:52:18 UTC
Created attachment 10323 [details]
Test patch

I think this might be cleaner (less additional #ifdefs :-).

Can you confirm it works and get back to me, then I'll propose it for master ?

Thanks,

Jeremy.
Comment 2 YOUZHONG YANG 2014-10-03 02:10:26 UTC
Yes, it works. 

Thank you.
Comment 3 Jeremy Allison 2014-10-07 00:12:41 UTC
This is the patch that went into master (no applicable to earlier versions).
Comment 4 Stefan Metzmacher 2014-10-14 08:45:43 UTC
We also need this for 4.2
Comment 5 Stefan Metzmacher 2015-01-26 13:03:21 UTC
Created attachment 10664 [details]
Patch for v4-2-test
Comment 6 Jeremy Allison 2015-01-26 20:15:05 UTC
Comment on attachment 10664 [details]
Patch for v4-2-test

LGTM.
Comment 7 Jeremy Allison 2015-01-26 20:15:25 UTC
Re-assigning to Karolin for inclusion in 4.2.0.
Comment 8 Karolin Seeger 2015-01-26 20:20:01 UTC
Pushed to autobuild-v4-2-test.
Comment 9 Stefan Metzmacher 2015-01-28 22:34:56 UTC
Pushed to v4-2-test.
Closing out bug report.

Thanks!