aboutgitcodebugslistschat
diff options
context:
space:
mode:
-rw-r--r--arch.c4
-rw-r--r--netlink.c3
-rw-r--r--tap.c5
3 files changed, 7 insertions, 5 deletions
diff --git a/arch.c b/arch.c
index 10eb24a..a2c4562 100644
--- a/arch.c
+++ b/arch.c
@@ -25,7 +25,7 @@
#ifdef __x86_64__
void arch_avx2_exec(char **argv)
{
- char exe[PATH_MAX] = { 0 }, new_path[PATH_MAX + sizeof(".avx2")], *p;
+ char exe[PATH_MAX] = { 0 }, *p;
if (readlink("/proc/self/exe", exe, PATH_MAX - 1) < 0) {
perror("readlink /proc/self/exe");
@@ -37,6 +37,8 @@ void arch_avx2_exec(char **argv)
return;
if (__builtin_cpu_supports("avx2")) {
+ char new_path[PATH_MAX + sizeof(".avx2")];
+
snprintf(new_path, PATH_MAX + sizeof(".avx2"), "%s.avx2", exe);
execve(new_path, argv, environ);
perror("Can't run AVX2 build, using non-AVX2 version");
diff --git a/netlink.c b/netlink.c
index 8ad6a0c..6f7ada8 100644
--- a/netlink.c
+++ b/netlink.c
@@ -147,7 +147,6 @@ unsigned int nl_get_ext_if(sa_family_t af)
};
struct nlmsghdr *nh;
struct rtattr *rta;
- struct rtmsg *rtm;
char buf[BUFSIZ];
ssize_t n;
size_t na;
@@ -158,7 +157,7 @@ unsigned int nl_get_ext_if(sa_family_t af)
nh = (struct nlmsghdr *)buf;
for ( ; NLMSG_OK(nh, n); nh = NLMSG_NEXT(nh, n)) {
- rtm = (struct rtmsg *)NLMSG_DATA(nh);
+ struct rtmsg *rtm = (struct rtmsg *)NLMSG_DATA(nh);
if (rtm->rtm_dst_len || rtm->rtm_family != af)
continue;
diff --git a/tap.c b/tap.c
index 4d7422f..5540c18 100644
--- a/tap.c
+++ b/tap.c
@@ -782,12 +782,12 @@ restart:
*/
static void tap_sock_unix_init(struct ctx *c)
{
- int fd = socket(AF_UNIX, SOCK_STREAM, 0), ex;
+ int fd = socket(AF_UNIX, SOCK_STREAM, 0);
struct epoll_event ev = { 0 };
struct sockaddr_un addr = {
.sun_family = AF_UNIX,
};
- int i, ret;
+ int i;
if (fd < 0) {
perror("UNIX socket");
@@ -802,6 +802,7 @@ static void tap_sock_unix_init(struct ctx *c)
for (i = 1; i < UNIX_SOCK_MAX; i++) {
char *path = addr.sun_path;
+ int ex, ret;
if (*c->sock_path)
memcpy(path, c->sock_path, UNIX_PATH_MAX);