X-Git-Url: https://git.deb.at/?a=blobdiff_plain;f=robot.c;h=cbd5cb22902a0a8cf91f9ea54e1584b20d2e869d;hb=28e57b8c74635460d8380fcc533f161f37cb12d3;hp=23875a3bd4b9984bf0c1815e95e7970c5f8318e2;hpb=89d91b6cfd98e514b3e418526ba854d00beb876c;p=pkg%2Fnetris.git diff --git a/robot.c b/robot.c index 23875a3..cbd5cb2 100644 --- a/robot.c +++ b/robot.c @@ -35,7 +35,7 @@ static EventGenRec robotGen = { NULL, 0, FT_read, -1, RobotGenFunc, EM_robot }; static int robotProcess; -static FILE *toRobot; +static FILE *toRobot = NULL; static int toRobotFd, fromRobotFd; static char robotBuf[128]; @@ -112,10 +112,13 @@ ExtFunc void RobotTimeStamp(void) ExtFunc void CloseRobot(void) { RemoveEventGen(&robotGen); - if (robotProcess > 0) - RobotCmd(1, "Exit\n"); - fclose(toRobot); - close(fromRobotFd); + if(toRobot) { + if (robotProcess > 0) + RobotCmd(1, "Exit\n"); + fclose(toRobot); + close(fromRobotFd); + toRobot = NULL; + } } static MyEventType RobotGenFunc(EventGenRec *gen, MyEvent *event)