*
* This code is Copyright (c) 2002, by the authors of nmh. See the
* COPYRIGHT file in the root directory of the nmh distribution for
*
* This code is Copyright (c) 2002, by the authors of nmh. See the
* COPYRIGHT file in the root directory of the nmh distribution for
enum locktype { FCNTL_LOCKING, FLOCK_LOCKING, LOCKF_LOCKING, DOT_LOCKING };
enum locktype { FCNTL_LOCKING, FLOCK_LOCKING, LOCKF_LOCKING, DOT_LOCKING };
-/*
- * Flags to indicate whether we've initialized the lock types, and
- * our saved lock types
- */
-static int datalockinit = 0;
-static int spoollockinit = 0;
+/* Our saved lock types. */
static int lkopen_flock (const char *, int, mode_t, int *);
#endif /* HAVE_FLOCK */
static int lkopen_flock (const char *, int, mode_t, int *);
#endif /* HAVE_FLOCK */
static int lkopen_dot (const char *, int, mode_t, int *);
static void lkclose_dot (int, const char *);
static int lkopen_dot (const char *, int, mode_t, int *);
static void lkclose_dot (int, const char *);
int
lkopendata(const char *file, int access, mode_t mode, int *failed_to_lock)
{
int
lkopendata(const char *file, int access, mode_t mode, int *failed_to_lock)
{
}
return lkopen(file, access, mode, datalocktype, failed_to_lock);
}
return lkopen(file, access, mode, datalocktype, failed_to_lock);
-int lkopenspool(const char *file, int access, mode_t mode, int *failed_to_lock)
+int
+lkopenspool(const char *file, int access, mode_t mode, int *failed_to_lock)
}
return lkopen(file, access, mode, spoollocktype, failed_to_lock);
}
return lkopen(file, access, mode, spoollocktype, failed_to_lock);
fd = link(tmpfile, curlock);
(void) m_unlink(tmpfile);
fd = link(tmpfile, curlock);
(void) m_unlink(tmpfile);
snprintf (bp, sizeof(li->curlock) - bplen, "%s.lock", cp);
snprintf (bp, sizeof(li->curlock) - bplen, "%s.lock", cp);
/*
* If this is for a new lock, create a name for
* the temporary lock file for lockit()
/*
* If this is for a new lock, create a name for
* the temporary lock file for lockit()