-/* Copyright (C) 1985, 1986, 1987, 1993 Free Software Foundation, Inc.
+/* Copyright (C) 1985, 1986, 1987, 1993, 1994 Free Software Foundation, Inc.
This file is part of GNU Emacs.
#include <sys/types.h>
#include <sys/stat.h>
-#include "config.h"
+#include <config.h>
#ifdef VMS
#include "vms-pwd.h"
#endif /* USG */
#include "lisp.h"
-#include "paths.h"
+#include <paths.h>
#include "buffer.h"
+#ifdef SYSV_SYSTEM_DIR
+#include <dirent.h>
+#else /* not SYSV_SYSTEM_DIR */
+#ifdef NONSYSTEM_DIR_LIBRARY
+#include "ndir.h"
+#else /* not NONSYSTEM_DIR_LIBRARY */
+#ifdef MSDOS
+#include <dirent.h>
+#else
+#include <sys/dir.h>
+#endif
+#endif /* not NONSYSTEM_DIR_LIBRARY */
+#ifndef MSDOS
+extern DIR *opendir ();
+#endif /* not MSDOS */
+#endif /* not SYSV_SYSTEM_DIR */
+
extern int errno;
extern char *egetenv ();
for (p = XSTRING (fn)->data; new = *p++; )
{
- new += crc.byte[7];
- crc.byte[7] = crc.byte[6];
+ new += crc.byte[6];
crc.byte[6] = crc.byte[5] + new;
crc.byte[5] = crc.byte[4];
crc.byte[4] = crc.byte[3];
/* If HAVE_LONG_FILE_NAMES is not defined, the lock file name is the hex
representation of a 14-bytes CRC generated from the file name
and put in the Emacs lock directory (not very nice, but it works).
- (ie., /ka/king/junk.tex -> /!/ec92d3ed24a8f0). */
+ (ie., /ka/king/junk.tex -> /!/12a82c62f1c6da). */
void
lock_file (fn)
/* See if this file is visited and has changed on disk since it was
visited. */
{
- register Lisp_Object subject_buf = Fget_file_buffer (fn);
+ register Lisp_Object subject_buf;
+ subject_buf = Fget_file_buffer (fn);
if (!NILP (subject_buf)
&& NILP (Fverify_visited_file_modtime (subject_buf))
&& !NILP (Ffile_exists_p (fn)))
char *lfname;
{
register int i, fd;
+ DIR *lockdir;
for (i = -20; i < 0 && (fd = open (superlock_path,
O_WRONLY | O_EXCL | O_CREAT, 0666)) < 0;
{
if (errno != EEXIST)
return;
+
+ /* This seems to be necessary to prevent Emacs from hanging when the
+ competing process has already deleted the superlock, but it's still
+ in the NFS cache. So we force NFS to synchronize the cache. */
+ if (lockdir = opendir (lock_path))
+ closedir (lockdir);
+
sleep (1);
}
if (fd >= 0)