From: Etienne Dechamps Date: Sat, 6 Sep 2014 09:43:15 +0000 (+0100) Subject: Don't enable the device if the reachable count is zero. X-Git-Tag: release-1.1pre11~47 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=7ac52637659b7f17ab5139010f0436aefcf9625c;p=oweals%2Ftinc.git Don't enable the device if the reachable count is zero. A logic bug was introduced in bd451cfe1512fa69eac35a60dbe6df17bfc39154 in which running graph() several times with zero reachable nodes had the effect of calling device_enable() (instead of keeping the device disabled). This results in weird behavior when DeviceStandby is enabled, especially on Windows where calling device_enable() several times in a row corrupts I/O structures for the device, rendering it unusable. --- diff --git a/src/graph.c b/src/graph.c index 8f601c2..690f4bd 100644 --- a/src/graph.c +++ b/src/graph.c @@ -292,7 +292,7 @@ static void check_reachability(void) { if (device_standby) { if (reachable_count == 0 && became_unreachable_count > 0) device_disable(); - else if (reachable_count == became_reachable_count) + else if (reachable_count > 0 && reachable_count == became_reachable_count) device_enable(); } }