From 1f27022fa75b71ce7da63ffa47b457622e74d6a1 Mon Sep 17 00:00:00 2001 From: Joseph Henry Date: Fri, 20 Nov 2015 01:08:38 -0800 Subject: Test/Code Refactor in preparation for merge --- netcon/Sendfd.c | 38 +++++++++++++++++++++++++++++++------- 1 file changed, 31 insertions(+), 7 deletions(-) (limited to 'netcon/Sendfd.c') diff --git a/netcon/Sendfd.c b/netcon/Sendfd.c index 0f320d0b..fe2ec230 100644 --- a/netcon/Sendfd.c +++ b/netcon/Sendfd.c @@ -1,4 +1,31 @@ +/* + * ZeroTier One - Network Virtualization Everywhere + * Copyright (C) 2011-2015 ZeroTier, Inc. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + * -- + * + * ZeroTier may be used and distributed under the terms of the GPLv3, which + * are available at: http://www.gnu.org/licenses/gpl-3.0.html + * + * If you would like to embed ZeroTier into a commercial application or + * redistribute it in a modified binary form, please contact ZeroTier Networks + * LLC. Start here: http://www.zerotier.com/ + */ + #include #include #include @@ -17,10 +44,9 @@ ssize_t sock_fd_write(int sock, int fd) char buf = '\0'; int buflen = 1; - union - { - struct cmsghdr cmsghdr; - char control[CMSG_SPACE(sizeof (int))]; + union { + struct cmsghdr cmsghdr; + char control[CMSG_SPACE(sizeof (int))]; } cmsgu; struct cmsghdr *cmsg; @@ -55,12 +81,10 @@ ssize_t sock_fd_write(int sock, int fd) ssize_t sock_fd_read(int sock, void *buf, ssize_t bufsize, int *fd) { ssize_t size; - if (fd) { struct msghdr msg; struct iovec iov; - union - { + union { struct cmsghdr cmsghdr; char control[CMSG_SPACE(sizeof (int))]; } cmsgu; -- cgit v1.2.3