]> git.ipfire.org Git - thirdparty/openssh-portable.git/commitdiff
wrap a declaration in the same ifdefs as its use
authorDamien Miller <djm@mindrot.org>
Tue, 4 Aug 2020 04:59:21 +0000 (14:59 +1000)
committerDamien Miller <djm@mindrot.org>
Tue, 4 Aug 2020 04:59:21 +0000 (14:59 +1000)
avoids warnings on NetBSD

openbsd-compat/port-net.c

index 617bffcebe8adddf06862122966958768fca84d9..d7d8c6fa1aa14f7920e5e6c3d0a96e56c0927fe7 100644 (file)
@@ -209,8 +209,11 @@ sys_tun_open(int tun, int mode, char **ifname)
 {
        struct ifreq ifr;
        char name[100];
-       int fd = -1, sock, flag;
+       int fd = -1, sock;
        const char *tunbase = "tun";
+#if defined(TUNSIFHEAD) && !defined(SSH_TUN_PREPEND_AF)
+       int flag;
+#endif
 
        if (ifname != NULL)
                *ifname = NULL;
@@ -247,8 +250,8 @@ sys_tun_open(int tun, int mode, char **ifname)
        }
 
        /* Turn on tunnel headers */
-       flag = 1;
 #if defined(TUNSIFHEAD) && !defined(SSH_TUN_PREPEND_AF)
+       flag = 1;
        if (mode != SSH_TUNMODE_ETHERNET &&
            ioctl(fd, TUNSIFHEAD, &flag) == -1) {
                debug("%s: ioctl(%d, TUNSIFHEAD, 1): %s", __func__, fd,