From: Joshua Kwan Date: Tue, 3 Feb 2004 03:02:19 +0000 (+0000) Subject: attempt to remove the inprogress file on an unclean termination X-Git-Tag: v1.6.1-roc-dev~477 X-Git-Url: https://skyeroc.xyz/gitweb/?a=commitdiff_plain;h=09b7c71f7242618b2a5c5612e358dfda00bd62f0;p=dgamelaunch attempt to remove the inprogress file on an unclean termination git-svn-id: svn://katsu.triplehelix.org/dgamelaunch/trunk@222 db0b04b0-f4d1-0310-9a6d-de3e77497b0e --- diff --git a/ttyrec.c b/ttyrec.c index f39da22..1777d7e 100644 --- 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); +} diff --git a/ttyrec.h b/ttyrec.h index 9270624..237d115 100644 --- 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);