X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?p=sympathy.git;a=blobdiff_plain;f=src%2Flockfile.c;h=ce37079bf4eff7b3b54c540f50ccb6be4d49a00c;hp=b3252746a902fcb82aa01be5e9d5bbaaa26bac6a;hb=3e72a1f6fc28777c26e4fb109867bd2a3c7b89b0;hpb=1191192d054da2be10658472c29f95e2494ea18f diff --git a/src/lockfile.c b/src/lockfile.c index b325274..ce37079 100644 --- a/src/lockfile.c +++ b/src/lockfile.c @@ -10,6 +10,9 @@ static char rcsid[] = "$Id$"; /* * $Log$ + * Revision 1.9 2008/02/15 23:52:12 james + * *** empty log message *** + * * Revision 1.8 2008/02/15 20:52:36 james * *** empty log message *** * @@ -39,6 +42,8 @@ static char rcsid[] = "$Id$"; #define LOCK_ASCII #undef LOCK_BINARY +#define STALE_CHECK_INTERVAL 10 + #include #include #include @@ -51,6 +56,8 @@ static char rcsid[] = "$Id$"; #include #include #include +#include +#include #include "lockfile.h" @@ -208,7 +215,7 @@ lockfile_add_places (Filelist * fl, char *leaf) char *lock_dirs[] = { "/var/lock/uucp", "/var/spool/lock", "/var/spool/uucp", "/etc/locks", "/usr/spool/uucp", "/var/spool/locks", "/usr/spool/lock", - "/usr/spool/locks", "/usr/spool/uucp/LCK" + "/usr/spool/locks", "/usr/spool/uucp/LCK", "/var/lock" }; int i; @@ -457,7 +464,7 @@ serial_lock_check (Serial_lock * l) if (l->mode == SERIAL_LOCK_ACTIVE) return 0; - for (fle = l->locks_to_check; fle; fle = fle->next) + for (fle = l->locks_to_check->head; fle; fle = fle->next) { if (!stat (fle->name, &buf)) locks_found++; @@ -466,7 +473,7 @@ serial_lock_check (Serial_lock * l) if (!locks_found) return 0; - getimeofday (&now, NULL); + gettimeofday (&now, NULL); timersub (&now, &l->last_stale_purge, &dif); if (dif.tv_sec > STALE_CHECK_INTERVAL) @@ -503,10 +510,13 @@ Serial_lock * serial_lock_new (char *dev, int mode) { Filelist *fl = lockfile_make_list (dev); + Serial_lock *l; if (!fl) return NULL; + l = (Serial_lock *) malloc (sizeof (Serial_lock)); + l->mode = mode; l->locks_to_check = fl; l->locks_held = NULL; @@ -526,7 +536,7 @@ serial_lock_new (char *dev, int mode) } -#if 1 +#if 0 int main (int argc, char *argv[]) {