mirror of
https://github.com/paxed/dgamelaunch.git
synced 2025-07-31 01:24:43 +02:00
Terminate if user chooses not to kill a hung game, and don't delete lockfile
in that case. Move purge_stale_locks() call to before final endwin() in main(). git-svn-id: svn://katsu.triplehelix.org/dgamelaunch/trunk@69 db0b04b0-f4d1-0310-9a6d-de3e77497b0e
This commit is contained in:
parent
f20200f40c
commit
acfec7933e
@ -1130,7 +1130,7 @@ purge_stale_locks (void)
|
|||||||
char *colon;
|
char *colon;
|
||||||
char buf[16];
|
char buf[16];
|
||||||
pid_t pid;
|
pid_t pid;
|
||||||
int seconds = 0;
|
int seconds;
|
||||||
|
|
||||||
if (!strcmp(dent->d_name, ".") || !strcmp(dent->d_name, ".."))
|
if (!strcmp(dent->d_name, ".") || !strcmp(dent->d_name, ".."))
|
||||||
continue;
|
continue;
|
||||||
@ -1150,7 +1150,6 @@ purge_stale_locks (void)
|
|||||||
graceful_exit (203);
|
graceful_exit (203);
|
||||||
|
|
||||||
fclose (ipfile);
|
fclose (ipfile);
|
||||||
unlink (dent->d_name);
|
|
||||||
|
|
||||||
pid = atoi (buf);
|
pid = atoi (buf);
|
||||||
|
|
||||||
@ -1159,6 +1158,7 @@ purge_stale_locks (void)
|
|||||||
errno = 0;
|
errno = 0;
|
||||||
|
|
||||||
/* Wait for it to stop running */
|
/* Wait for it to stop running */
|
||||||
|
seconds = 0;
|
||||||
while (kill (pid, 0) == 0)
|
while (kill (pid, 0) == 0)
|
||||||
{
|
{
|
||||||
seconds++;
|
seconds++;
|
||||||
@ -1175,9 +1175,16 @@ purge_stale_locks (void)
|
|||||||
kill (pid, SIGTERM);
|
kill (pid, SIGTERM);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
endwin();
|
||||||
|
fprintf(stderr, "Sorry, no nethack for you now, please "
|
||||||
|
"contact the admin.\n");
|
||||||
|
graceful_exit(1);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
seconds = 0;
|
unlink (dent->d_name);
|
||||||
}
|
}
|
||||||
|
|
||||||
closedir (pdir);
|
closedir (pdir);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user