From: Guus Sliepen Date: Tue, 22 Jun 2021 20:35:50 +0000 (+0200) Subject: Reformat the code using astyle. X-Git-Tag: release-1.1pre18~14 X-Git-Url: https://www.tinc-vpn.org/git/browse?p=tinc;a=commitdiff_plain;h=628739fb41f3877b2da0f8fb50793a2f51ff70c4 Reformat the code using astyle. --- diff --git a/src/conf.c b/src/conf.c index 4fcf82de..67e14265 100644 --- a/src/conf.c +++ b/src/conf.c @@ -206,7 +206,7 @@ bool get_config_subnet(const config_t *cfg, subnet_t **result) { return false; } - if (subnetcheck(subnet)) { + if(subnetcheck(subnet)) { *(*result = new_subnet()) = subnet; return true; } diff --git a/src/fd_device.c b/src/fd_device.c index eab9e160..5cfe75fe 100644 --- a/src/fd_device.c +++ b/src/fd_device.c @@ -55,9 +55,12 @@ static int read_fd(int socket) { logger(DEBUG_ALWAYS, LOG_ERR, "Could not read from unix socket (error %d)!", ret); return -1; } + #ifdef IP_RECVERR + if(msg.msg_flags & (MSG_CTRUNC | MSG_OOB | MSG_ERRQUEUE)) { #else + if(msg.msg_flags & (MSG_CTRUNC | MSG_OOB)) { #endif logger(DEBUG_ALWAYS, LOG_ERR, "Error while receiving message (flags %d)!", msg.msg_flags); @@ -65,19 +68,22 @@ static int read_fd(int socket) { } cmsgptr = CMSG_FIRSTHDR(&msg); + if(cmsgptr->cmsg_level != SOL_SOCKET) { logger(DEBUG_ALWAYS, LOG_ERR, "Wrong CMSG level: %d, expected %d!", - cmsgptr->cmsg_level, SOL_SOCKET); + cmsgptr->cmsg_level, SOL_SOCKET); return -1; } + if(cmsgptr->cmsg_type != SCM_RIGHTS) { logger(DEBUG_ALWAYS, LOG_ERR, "Wrong CMSG type: %d, expected %d!", - cmsgptr->cmsg_type, SCM_RIGHTS); + cmsgptr->cmsg_type, SCM_RIGHTS); return -1; } + if(cmsgptr->cmsg_len != CMSG_LEN(sizeof(device_fd))) { logger(DEBUG_ALWAYS, LOG_ERR, "Wrong CMSG data length: %lu, expected %lu!", - (unsigned long)cmsgptr->cmsg_len, CMSG_LEN(sizeof(device_fd))); + (unsigned long)cmsgptr->cmsg_len, CMSG_LEN(sizeof(device_fd))); return -1; } @@ -113,7 +119,9 @@ static struct unix_socket_addr parse_socket_addr(const char *path) { if(strlen(path) >= sizeof(socket_addr.sun_path)) { logger(DEBUG_ALWAYS, LOG_ERR, "Unix socket path too long!"); - return (struct unix_socket_addr) {0}; + return (struct unix_socket_addr) { + 0 + }; } socket_addr.sun_family = AF_UNIX; diff --git a/src/tincctl.c b/src/tincctl.c index 0beebc21..87bbfe01 100644 --- a/src/tincctl.c +++ b/src/tincctl.c @@ -1887,7 +1887,7 @@ static int cmd_config(int argc, char *argv[]) { found = true; variable = (char *)variables[i].name; - if (!strcasecmp(variable, "Subnet")) { + if(!strcasecmp(variable, "Subnet")) { subnet_t s = {0}; if(!str2net(&s, value)) {