From e0caf865430ec7979d4dc974fe9bcfc20e3b14dc Mon Sep 17 00:00:00 2001 From: xkonni Date: Sun, 25 Nov 2012 02:18:24 +0100 Subject: [PATCH] daemon: fix error when exceeding nPlugs --- daemon.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/daemon.cpp b/daemon.cpp index 5424d25..b9ead08 100644 --- a/daemon.cpp +++ b/daemon.cpp @@ -112,8 +112,10 @@ int main(int argc, char* argv[]) { */ int nAddr = getAddr(nGroup, nSwitchNumber); char msg[13]; - if (nAddr > nPlugs) - printf("Switch invalid: %s::%d\n", nGroup, nSwitchNumber); + if (nAddr > nPlugs) { + printf("Switch out of range: %s:%d\n", nGroup, nSwitchNumber); + n = write(newsockfd,"2",1); + } else { switch (nAction) { /**