]> skyeroc.xyz Git - dgamelaunch/commitdiff
Provide some feedback to the user that he has a stale game.
authorJilles Tjoelker <jilles@stack.nl>
Sun, 4 Jan 2004 02:56:09 +0000 (02:56 +0000)
committerJilles Tjoelker <jilles@stack.nl>
Sun, 4 Jan 2004 02:56:09 +0000 (02:56 +0000)
git-svn-id: svn://katsu.triplehelix.org/dgamelaunch/trunk@72 db0b04b0-f4d1-0310-9a6d-de3e77497b0e

dgamelaunch.c

index c664a95eee8503f1f5421a7a4ebaed0c07408d2c..eb1a3c48fb3baada7511a550670522e631946dfe 100644 (file)
@@ -1160,9 +1160,11 @@ purge_stale_locks (void)
         graceful_exit (203);
 
       fclose (ipfile);
-      unlink (fn);
 
-      free(fn);
+      clear ();
+      drawbanner (1, 1);
+      mvaddstr (3, 1, "There is a stale Nethack process, attempting to recover...");
+      refresh ();
 
       pid = atoi (buf);
 
@@ -1178,8 +1180,6 @@ purge_stale_locks (void)
           sleep (1);
           if (seconds == 10)
             {
-              clear ();
-              drawbanner (1, 1);
               mvaddstr (3, 1,
                         "Couldn't terminate one of your stale Nethack processes gracefully.");
               mvaddstr (4, 1, "Force its termination? [yn] ");
@@ -1197,7 +1197,10 @@ purge_stale_locks (void)
                }
             }
         }
-      unlink (dent->d_name);
+
+      /* Don't remove the lock file until the process is dead. */
+      unlink (fn);
+      free (fn);
     }
 
   closedir (pdir);