diff options
| author | Karl Heuer <kwzh@gnu.org> | 1994-03-11 02:35:50 +0000 |
|---|---|---|
| committer | Karl Heuer <kwzh@gnu.org> | 1994-03-11 02:35:50 +0000 |
| commit | 25bef3dd72861957eb6b9c7dac7be4b4d9a67f20 (patch) | |
| tree | 99d3cfad7a34c816d448106d3eeb781127937c90 /src | |
| parent | 6483e43f349b10e370a796bbee8b9d9de82c32f7 (diff) | |
| download | emacs-25bef3dd72861957eb6b9c7dac7be4b4d9a67f20.tar.gz | |
(lock_superlock): Synchronize NFS cache.
Diffstat (limited to 'src')
| -rw-r--r-- | src/filelock.c | 25 |
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. */ #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 (); @@ -325,6 +342,7 @@ lock_superlock (lfname) 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; @@ -332,6 +350,13 @@ lock_superlock (lfname) { 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) |
