diff --git a/lockfile.c b/lockfile.c
index 261baff049cd8b2e4d1b1a269992851eb00b2aa8..731bbf3c9c312687714d19391e6e02ffde8eaebd 100644 (file)
--- a/lockfile.c
+++ b/lockfile.c
sprintf(lk->filename, "%s.lock", path);
fd = open(lk->filename, O_RDWR | O_CREAT | O_EXCL, 0666);
if (0 <= fd) {
- if (!lk->next) {
+ if (!lk->on_list) {
lk->next = lock_file_list;
lock_file_list = lk;
+ lk->on_list = 1;
+ }
+ if (lock_file_list) {
signal(SIGINT, remove_lock_file_on_signal);
atexit(remove_lock_file);
}
return error("cannot fix permission bits on %s",
lk->filename);
}
+ else
+ lk->filename[0] = 0;
return fd;
}