From 3a2bbdb05ca6a6996e424c9fb225cb0d53804125 Mon Sep 17 00:00:00 2001 From: Alberto Gonzalez Iniesta Date: Tue, 27 Dec 2016 18:25:47 +0100 Subject: New upstream version 2.4.0 --- src/openvpn/fdmisc.c | 48 +++++++++++++++++++++++++++++------------------- 1 file changed, 29 insertions(+), 19 deletions(-) (limited to 'src/openvpn/fdmisc.c') diff --git a/src/openvpn/fdmisc.c b/src/openvpn/fdmisc.c index ce01319..401069d 100644 --- a/src/openvpn/fdmisc.c +++ b/src/openvpn/fdmisc.c @@ -5,7 +5,7 @@ * packet encryption, packet authentication, and * packet compression. * - * Copyright (C) 2002-2010 OpenVPN Technologies, Inc. + * Copyright (C) 2002-2017 OpenVPN Technologies, Inc. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 @@ -37,42 +37,52 @@ /* Set a file descriptor to non-blocking */ bool -set_nonblock_action (int fd) +set_nonblock_action(int fd) { #ifdef _WIN32 - u_long arg = 1; - if (ioctlsocket (fd, FIONBIO, &arg)) - return false; -#else - if (fcntl (fd, F_SETFL, O_NONBLOCK) < 0) - return false; + u_long arg = 1; + if (ioctlsocket(fd, FIONBIO, &arg)) + { + return false; + } +#else /* ifdef _WIN32 */ + if (fcntl(fd, F_SETFL, O_NONBLOCK) < 0) + { + return false; + } #endif - return true; + return true; } /* Set a file descriptor to not be passed across execs */ bool -set_cloexec_action (int fd) +set_cloexec_action(int fd) { #ifndef _WIN32 - if (fcntl (fd, F_SETFD, FD_CLOEXEC) < 0) - return false; + if (fcntl(fd, F_SETFD, FD_CLOEXEC) < 0) + { + return false; + } #endif - return true; + return true; } /* Set a file descriptor to non-blocking */ void -set_nonblock (int fd) +set_nonblock(int fd) { - if (!set_nonblock_action (fd)) - msg (M_ERR, "Set socket to non-blocking mode failed"); + if (!set_nonblock_action(fd)) + { + msg(M_ERR, "Set socket to non-blocking mode failed"); + } } /* Set a file descriptor to not be passed across execs */ void -set_cloexec (int fd) +set_cloexec(int fd) { - if (!set_cloexec_action (fd)) - msg (M_ERR, "Set FD_CLOEXEC flag on file descriptor failed"); + if (!set_cloexec_action(fd)) + { + msg(M_ERR, "Set FD_CLOEXEC flag on file descriptor failed"); + } } -- cgit v1.2.3