summaryrefslogtreecommitdiff
path: root/net/tap.c
diff options
context:
space:
mode:
authorJuergen Lock <nox@jelal.kn-bremen.de>2009-11-20 23:23:03 +0100
committerBlue Swirl <blauwirbel@gmail.com>2009-11-21 09:32:15 +0000
commit929fe497219cdf0f060f430a59062bd44b30ec8a (patch)
tree6261ae48a2f613d12042d9e311d0629338021a1a /net/tap.c
parent2f859a3c10c8a038661592fcdfe003ec97cca938 (diff)
downloadqemu-929fe497219cdf0f060f430a59062bd44b30ec8a.tar.gz
qemu-929fe497219cdf0f060f430a59062bd44b30ec8a.tar.bz2
qemu-929fe497219cdf0f060f430a59062bd44b30ec8a.zip
Avoid segfault on net_tap_init() failure
Check for fd == -1 there. Signed-off-by: Juergen Lock <nox@jelal.kn-bremen.de> Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
Diffstat (limited to 'net/tap.c')
-rw-r--r--net/tap.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/net/tap.c b/net/tap.c
index 69c905cdc1..b2e5908c35 100644
--- a/net/tap.c
+++ b/net/tap.c
@@ -399,6 +399,9 @@ int net_init_tap(QemuOpts *opts, Monitor *mon, const char *name, VLANState *vlan
}
fd = net_tap_init(opts, &vnet_hdr);
+ if (fd == -1) {
+ return -1;
+ }
}
s = net_tap_fd_init(vlan, "tap", name, fd, vnet_hdr);