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>
stable-0.12
Juergen Lock 2009-11-20 23:23:03 +01:00 committed by Blue Swirl
parent 2f859a3c10
commit 929fe49721
1 changed files with 3 additions and 0 deletions

View File

@ -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);