]> git.deb.at Git - pkg/netris.git/blobdiff - debian/patches/04_robot-close-fixup
Imported Debian patch 0.52-7
[pkg/netris.git] / debian / patches / 04_robot-close-fixup
diff --git a/debian/patches/04_robot-close-fixup b/debian/patches/04_robot-close-fixup
new file mode 100644 (file)
index 0000000..74cfec4
--- /dev/null
@@ -0,0 +1,31 @@
+Index: netris-0.52/robot.c
+===================================================================
+--- netris-0.52.orig/robot.c
++++ netris-0.52/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)