]> git.deb.at Git - pkg/netris.git/blob - debian/patches/04_robot-close-fixup
74cfec4425f774c9563475d572672c1eae8057c9
[pkg/netris.git] / debian / patches / 04_robot-close-fixup
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 };
7  
8  static int robotProcess;
9 -static FILE *toRobot;
10 +static FILE *toRobot = NULL;
11  static int toRobotFd, fromRobotFd;
12  
13  static char robotBuf[128];
14 @@ -112,10 +112,13 @@ ExtFunc void RobotTimeStamp(void)
15  ExtFunc void CloseRobot(void)
16  {
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 +       }
29  }
30  
31  static MyEventType RobotGenFunc(EventGenRec *gen, MyEvent *event)