From: H.G.Muller Date: Wed, 29 Oct 2014 21:46:59 +0000 (+0100) Subject: Don't forget to quit engine when GUI dies unexpectedly X-Git-Tag: v2.0~6 X-Git-Url: http://winboard.nl/cgi-bin?a=commitdiff_plain;h=d4c964cc8830407dbc9efa12a1d50e4ce48b711a;p=uci2wb.git Don't forget to quit engine when GUI dies unexpectedly When we get an EOF signal from the GUI pipe, meaning that the GUI died without sending a 'quit' command, we'd better shutdown the engine before exiting ourself. --- diff --git a/UCI2WB.c b/UCI2WB.c index 7aaad84..77b671b 100644 --- a/UCI2WB.c +++ b/UCI2WB.c @@ -383,7 +383,7 @@ GUI2Engine() nomove: fflush(toE); fflush(stdout); i = 0; while((x = getchar()) != EOF && (line[i] = x) != '\n') i++; - line[++i] = 0; if(x == EOF) { printf("# EOF\n"); exit(-1); } + line[++i] = 0; if(x == EOF) { printf("# EOF\n"); fprintf(toE, "quit\n"); exit(-1); } sscanf(line, "%s", command); if(!strcmp(command, "new")) { computer = BLACK; moveNr = 0; depth = -1; move[0][0] = 0;