stuff med printf

This commit is contained in:
Bjorn Andersson 2006-06-05 13:40:07 +00:00
parent 33f8a07aa6
commit 8631c2991c
1 changed files with 4 additions and 2 deletions

6
tun.c
View File

@ -59,7 +59,7 @@ open_tun()
snprintf(ifreq.ifr_name, IFNAMSIZ, "dns%d", i); snprintf(ifreq.ifr_name, IFNAMSIZ, "dns%d", i);
if (ioctl(tun_fd, TUNSETIFF, (void *) &ifreq) != -1) { if (ioctl(tun_fd, TUNSETIFF, (void *) &ifreq) != -1) {
printf("opened %s\n", ifreq.ifr_name); printf("Opened %s\n", ifreq.ifr_name);
return 0; return 0;
} }
@ -87,8 +87,10 @@ open_tun()
for (i = 0; i < TUN_MAX_TRY; i++) { for (i = 0; i < TUN_MAX_TRY; i++) {
snprintf(tun_name, sizeof(tun_name), "/dev/tun%d", i); snprintf(tun_name, sizeof(tun_name), "/dev/tun%d", i);
if ((tun_fd = open(tun_name, O_RDWR)) >= 0) if ((tun_fd = open(tun_name, O_RDWR)) >= 0) {
printf("Opened %s\n", tun_name);
return 0; return 0;
}
if (errno == ENOENT) if (errno == ENOENT)
break; break;