]> skyeroc.xyz Git - dgamelaunch/commitdiff
attempt to remove the inprogress file on an unclean termination
authorJoshua Kwan <joshk@triplehelix.org>
Tue, 3 Feb 2004 03:02:19 +0000 (03:02 +0000)
committerJoshua Kwan <joshk@triplehelix.org>
Tue, 3 Feb 2004 03:02:19 +0000 (03:02 +0000)
git-svn-id: svn://katsu.triplehelix.org/dgamelaunch/trunk@222 db0b04b0-f4d1-0310-9a6d-de3e77497b0e

ttyrec.c
ttyrec.h

index f39da22dfce332ddcaec17ebe2b2c8f71d22c8ba..1777d7ebfc373bb453f1817c052732e065b60e1b 100644 (file)
--- a/ttyrec.c
+++ b/ttyrec.c
@@ -89,6 +89,7 @@ ttyrec_main (char *username, char* ttyrec_filename)
   snprintf (dirname, 100, "%sttyrec/%s/%s", myconfig->dglroot, username,
             ttyrec_filename);
 
+  atexit(&remove_ipfile);
   if ((fscript = fopen (dirname, "w")) == NULL)
     {
       perror (dirname);
@@ -369,3 +370,10 @@ getslave ()
 #endif /* !NOSTREAMS */
   (void) ioctl (0, TIOCGWINSZ, (char *) &win);
 }
+
+void
+remove_ipfile (void)
+{
+  if (ipfile != NULL)
+    unlink (ipfile);
+}
index 9270624b37a0d10c0a48f0451d14a1528e27a8cf..237d115c964b8731720c7d342c1e4b8a1b1a88b8 100644 (file)
--- a/ttyrec.h
+++ b/ttyrec.h
@@ -19,6 +19,7 @@ extern void doinput (void);
 extern void dooutput (void);
 extern void doshell (char *);
 extern void finish (int);
+extern void remove_ipfile (void);
 
 extern int ttyrec_main(char *username, char *ttyrec_filename);