]> git.deb.at Git - pkg/netris.git/blob - debian/patches/04_robot-close-fixup
a24062c1c21b297447bb8fdd4a22773b705c9310
[pkg/netris.git] / debian / patches / 04_robot-close-fixup
1 Description: Small fix for CloseRobot function to close only if a robot is used
2
3 Index: netris-0.52/robot.c
4 ===================================================================
5 --- netris-0.52.orig/robot.c
6 +++ netris-0.52/robot.c
7 @@ -35,7 +35,7 @@ static EventGenRec robotGen =
8                 { NULL, 0, FT_read, -1, RobotGenFunc, EM_robot };
9  
10  static int robotProcess;
11 -static FILE *toRobot;
12 +static FILE *toRobot = NULL;
13  static int toRobotFd, fromRobotFd;
14  
15  static char robotBuf[128];
16 @@ -112,10 +112,13 @@ ExtFunc void RobotTimeStamp(void)
17  ExtFunc void CloseRobot(void)
18  {
19         RemoveEventGen(&robotGen);
20 -       if (robotProcess > 0)
21 -               RobotCmd(1, "Exit\n");
22 -       fclose(toRobot);
23 -       close(fromRobotFd);
24 +       if(toRobot) {
25 +               if (robotProcess > 0)
26 +                       RobotCmd(1, "Exit\n");
27 +               fclose(toRobot);
28 +               close(fromRobotFd);
29 +               toRobot = NULL;
30 +       }
31  }
32  
33  static MyEventType RobotGenFunc(EventGenRec *gen, MyEvent *event)