From d4c964cc8830407dbc9efa12a1d50e4ce48b711a Mon Sep 17 00:00:00 2001
From: H.G.Muller <hgm@hgm-xboard.(none)>
Date: Wed, 29 Oct 2014 22:46:59 +0100
Subject: [PATCH] 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.
---
 UCI2WB.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

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;
-- 
1.7.0.4