aboutsummaryrefslogtreecommitdiffstats
path: root/src/filelock.c
diff options
context:
space:
mode:
authorKarl Heuer1994-03-11 02:35:50 +0000
committerKarl Heuer1994-03-11 02:35:50 +0000
commit25bef3dd72861957eb6b9c7dac7be4b4d9a67f20 (patch)
tree99d3cfad7a34c816d448106d3eeb781127937c90 /src/filelock.c
parent6483e43f349b10e370a796bbee8b9d9de82c32f7 (diff)
downloademacs-25bef3dd72861957eb6b9c7dac7be4b4d9a67f20.tar.gz
emacs-25bef3dd72861957eb6b9c7dac7be4b4d9a67f20.zip
(lock_superlock): Synchronize NFS cache.
Diffstat (limited to 'src/filelock.c')
-rw-r--r--src/filelock.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/src/filelock.c b/src/filelock.c
index 52349ffa872..48d1f0f758b 100644
--- a/src/filelock.c
+++ b/src/filelock.c
@@ -37,6 +37,23 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
37#include <paths.h> 37#include <paths.h>
38#include "buffer.h" 38#include "buffer.h"
39 39
40#ifdef SYSV_SYSTEM_DIR
41#include <dirent.h>
42#else /* not SYSV_SYSTEM_DIR */
43#ifdef NONSYSTEM_DIR_LIBRARY
44#include "ndir.h"
45#else /* not NONSYSTEM_DIR_LIBRARY */
46#ifdef MSDOS
47#include <dirent.h>
48#else
49#include <sys/dir.h>
50#endif
51#endif /* not NONSYSTEM_DIR_LIBRARY */
52#ifndef MSDOS
53extern DIR *opendir ();
54#endif /* not MSDOS */
55#endif /* not SYSV_SYSTEM_DIR */
56
40extern int errno; 57extern int errno;
41 58
42extern char *egetenv (); 59extern char *egetenv ();
@@ -325,6 +342,7 @@ lock_superlock (lfname)
325 char *lfname; 342 char *lfname;
326{ 343{
327 register int i, fd; 344 register int i, fd;
345 DIR *lockdir;
328 346
329 for (i = -20; i < 0 && (fd = open (superlock_path, 347 for (i = -20; i < 0 && (fd = open (superlock_path,
330 O_WRONLY | O_EXCL | O_CREAT, 0666)) < 0; 348 O_WRONLY | O_EXCL | O_CREAT, 0666)) < 0;
@@ -332,6 +350,13 @@ lock_superlock (lfname)
332 { 350 {
333 if (errno != EEXIST) 351 if (errno != EEXIST)
334 return; 352 return;
353
354 /* This seems to be necessary to prevent Emacs from hanging when the
355 competing process has already deleted the superlock, but it's still
356 in the NFS cache. So we force NFS to synchronize the cache. */
357 if (lockdir = opendir (lock_path))
358 closedir (lockdir);
359
335 sleep (1); 360 sleep (1);
336 } 361 }
337 if (fd >= 0) 362 if (fd >= 0)