summaryrefslogtreecommitdiff
path: root/netcon/Sendfd.c
diff options
context:
space:
mode:
authorJoseph Henry <josephjah@gmail.com>2015-11-20 01:08:38 -0800
committerJoseph Henry <josephjah@gmail.com>2015-11-20 01:08:38 -0800
commit1f27022fa75b71ce7da63ffa47b457622e74d6a1 (patch)
tree4c562cf1fc12d2fbd3691f01859882f196b3a910 /netcon/Sendfd.c
parent9a25a627bba4a00465a3648b82fc89f61b980ed1 (diff)
downloadinfinitytier-1f27022fa75b71ce7da63ffa47b457622e74d6a1.tar.gz
infinitytier-1f27022fa75b71ce7da63ffa47b457622e74d6a1.zip
Test/Code Refactor in preparation for merge
Diffstat (limited to 'netcon/Sendfd.c')
-rw-r--r--netcon/Sendfd.c38
1 files changed, 31 insertions, 7 deletions
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 <http://www.gnu.org/licenses/>.
+ *
+ * --
+ *
+ * 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 <stdlib.h>
#include <unistd.h>
#include <stdio.h>
@@ -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;