- /*
- * We MUST have write permission or
- * lockf/fcntl() won't work
- */
- if ((access & 03) == O_RDONLY) {
- access &= ~O_RDONLY;
- access |= O_RDWR;
- }
-# endif /* LOCKF_LOCKING || FCNTL_LOCKING */
+#ifdef HAVE_FLOCK
+ case FLOCK_LOCKING:
+ return lkopen_flock(file, access, mode, failed_to_lock);
+#endif /* HAVE_FLOCK */
+
+#ifdef HAVE_LOCKF
+ case LOCKF_LOCKING:
+ return lkopen_lockf(file, access, mode, failed_to_lock);
+#endif /* HAVE_FLOCK */
+
+ default:
+ adios(NULL, "Internal locking error: unsupported lock type used!");
+ }
+
+ return -1;
+}
+
+
+/*
+ * Routine to clean up the dot locking file
+ */
+
+static void
+lkclose_dot (int fd, const char *file)
+{
+ struct lockinfo lkinfo;
+
+ lockname (file, &lkinfo, 0); /* get name of lock file */
+#if !defined(HAVE_LIBLOCKFILE)
+ (void) m_unlink (lkinfo.curlock); /* remove lock file */
+#else
+ lockfile_remove(lkinfo.curlock);
+#endif /* HAVE_LIBLOCKFILE */
+ timerOFF (fd); /* turn off lock timer */
+}