From 59ce931955ef12125e29335e2d293eba2c86ea37 Mon Sep 17 00:00:00 2001 From: kanjitalk755 Date: Sun, 8 Mar 2020 12:33:44 +0900 Subject: [PATCH] fixed destroying bridge --- BasiliskII/src/MacOSX/etherhelpertool.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/BasiliskII/src/MacOSX/etherhelpertool.c b/BasiliskII/src/MacOSX/etherhelpertool.c index 8ccaa517..2b1073e6 100644 --- a/BasiliskII/src/MacOSX/etherhelpertool.c +++ b/BasiliskII/src/MacOSX/etherhelpertool.c @@ -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); } }