Bug #153070 [0] was reported a few years ago. I am now the maintainer
of toshutils and am trying to resolve this bug. I can reproduce it
very easily. Thing is I am not sure if this is really a bug or if it is
the correct behavior. Essentially, if the pid file already exists in
/var/tmp and the program is not already running, and you run hotkey, it
emits a warning, removes the pid file and runs. On the other hand, if
the pid file exists and the program is already running, it sends a
SIGUSR1 and exits with status 1. Here is the relevant code from main():
if (!access(PID_FILE, R_OK)) {
if ((str = fopen(PID_FILE, "r" ))) {
fscanf(str, "%d", &pid);
fclose(str);
/* test to see if the other hotkey is still running */
if (kill(pid, SIGUSR1)==0) {
fprintf(stderr, "hotkey: Already running as "
"process %d.\n", pid);
return 1;
}
fprintf(stderr, "hotkey: process %d appears to have "
"died, continuing\n", pid);
unlink(PID_FILE);
}
}
It is obvious that the way the program is behaving the bug report is
they it is programmed to behave. I would like to know if there is a
better way to handle this.
-Roberto
[0] http://bugs.debian.org/153070
--
Roberto C. Sanchez
http://familiasanchez.net/~sanchezr
Attachment:
pgp2sL1yP8FDg.pgp
Description: PGP signature