--- net-tools-1.60/netplug-1.2.9/main.c 2004-02-22 06:52:14.000000000 +0100 +++ net-tools-1.60.new/netplug-1.2.9/main.c 2004-05-06 18:28:22.845977718 +0200 @@ -149,10 +149,10 @@ /* Poll the existing interface state, so we can catch any state changes for which we may not have neen a netlink message. */ +static int sockfd = -1; static void poll_interfaces(void) { - static int sockfd = -1; if (sockfd == -1) { sockfd = socket(PF_INET, SOCK_DGRAM, IPPROTO_IP); @@ -182,6 +182,12 @@ for_each_iface(pollflags); } +int poll_flags(struct if_info *i) { + if (if_match(i->name)) + ifsm_flagpoll(i); + return 0; +} + int debug = 0; int @@ -287,17 +293,11 @@ { child_handler_pipe[0], POLLIN, 0 }, }; - { - /* Run over each of the interfaces we know and care about, and - make sure the state machine has done the appropriate thing - for their current state. */ - int poll_flags(struct if_info *i) { - if (if_match(i->name)) - ifsm_flagpoll(i); - return 0; - } - for_each_iface(poll_flags); - } + /* Run over each of the interfaces we know and care about, and + make sure the state machine has done the appropriate thing + for their current state. */ + for_each_iface(poll_flags); + for(;;) { int ret;