wrap a declaration in the same ifdefs as its use

avoids warnings on NetBSD
This commit is contained in:
Damien Miller 2020-08-04 14:59:21 +10:00
parent c9e3be9f4b
commit 32c63e75a7

View File

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