mirror of
https://github.com/kanjitalk755/macemu.git
synced 2024-11-28 23:49:23 +00:00
fixed destroying bridge
This commit is contained in:
parent
f9eae2025f
commit
59ce931955
@ -55,7 +55,7 @@ static void handler(int signum);
|
||||
static int install_signal_handlers();
|
||||
static void do_exit();
|
||||
|
||||
static int remove_bridge = 0;
|
||||
static char remove_bridge[STR_MAX];
|
||||
static const char *exec_name = "etherhelpertool";
|
||||
|
||||
int main(int argc, char **argv)
|
||||
@ -415,7 +415,7 @@ static int open_tap(char *ifname)
|
||||
close(sd);
|
||||
return -1;
|
||||
}
|
||||
remove_bridge = 1;
|
||||
strlcpy(remove_bridge, bridge, STR_MAX);
|
||||
|
||||
snprintf(str, STR_MAX, "/sbin/ifconfig %s up", bridge);
|
||||
if (run_cmd(str) != 0) {
|
||||
@ -572,7 +572,9 @@ static int install_signal_handlers() {
|
||||
}
|
||||
|
||||
static void do_exit() {
|
||||
if (remove_bridge) {
|
||||
run_cmd("/sbin/ifconfig bridge0 destroy");
|
||||
if (*remove_bridge) {
|
||||
char str[STR_MAX];
|
||||
snprintf(str, STR_MAX, "/sbin/ifconfig %s destroy", remove_bridge);
|
||||
run_cmd(str);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user