#include <h/signals.h>
#include <h/utils.h>
#include <h/mts.h>
+#include "lock_file.h"
+#include "m_mktemp.h"
#ifdef HAVE_SYS_TIME_H
# include <sys/time.h>
static int lkopen_flock (const char *, int, mode_t, int *);
#endif /* HAVE_FLOCK */
-static enum locktype init_locktype(const char *);
+static enum locktype init_locktype(const char *) PURE;
static int lkopen_dot (const char *, int, mode_t, int *);
static void lkclose_dot (int, const char *);
lockname (file, &lkinfo, 1);
}
+ close(fd);
*failed_to_lock = 1;
return -1;
}
fd = link(tmpfile, curlock);
(void) m_unlink(tmpfile);
- return (fd == -1 ? -1 : 0);
+ return fd == -1 ? -1 : 0;
}
#endif /* HAVE_LIBLOCKFILE */
snprintf (bp, sizeof(li->curlock) - bplen, "%s.lock", cp);
-#if !defined(HAVE_LIBLOCKFILE)
+#if defined(HAVE_LIBLOCKFILE)
+ NMH_UNUSED(isnewlock);
+#else
/*
* If this is for a new lock, create a name for
* the temporary lock file for lockit()