updated on Mon Jan 23 12:00:23 UTC 2012
[aur-mirror.git] / netris / 04_robot-close-fixup.patch
blob74cfec4425f774c9563475d572672c1eae8057c9
1 Index: netris-0.52/robot.c
2 ===================================================================
3 --- netris-0.52.orig/robot.c
4 +++ netris-0.52/robot.c
5 @@ -35,7 +35,7 @@ static EventGenRec robotGen =
6 { NULL, 0, FT_read, -1, RobotGenFunc, EM_robot };
8 static int robotProcess;
9 -static FILE *toRobot;
10 +static FILE *toRobot = NULL;
11 static int toRobotFd, fromRobotFd;
13 static char robotBuf[128];
14 @@ -112,10 +112,13 @@ ExtFunc void RobotTimeStamp(void)
15 ExtFunc void CloseRobot(void)
17 RemoveEventGen(&robotGen);
18 - if (robotProcess > 0)
19 - RobotCmd(1, "Exit\n");
20 - fclose(toRobot);
21 - close(fromRobotFd);
22 + if(toRobot) {
23 + if (robotProcess > 0)
24 + RobotCmd(1, "Exit\n");
25 + fclose(toRobot);
26 + close(fromRobotFd);
27 + toRobot = NULL;
28 + }
31 static MyEventType RobotGenFunc(EventGenRec *gen, MyEvent *event)