summaryrefslogtreecommitdiffstats
path: root/mx.c
diff options
context:
space:
mode:
authorThomas Roessler <roessler@does-not-exist.org>1999-08-23 12:39:42 +0000
committerThomas Roessler <roessler@does-not-exist.org>1999-08-23 12:39:42 +0000
commit274bd0216e1c7420f34ad276e55239e80053c073 (patch)
tree91f18c021fc5d3d90df407e74972be456813a509 /mx.c
parent3f5d80031e778db8e9db52166772d4a8f3bf419d (diff)
Remove a couple of NFS-related hacks which seem to be unnecessary.
Diffstat (limited to 'mx.c')
-rw-r--r--mx.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/mx.c b/mx.c
index 77e1fddb..f072c7b8 100644
--- a/mx.c
+++ b/mx.c
@@ -295,12 +295,12 @@ void mx_unlink_empty (const char *path)
{
int fd;
#ifndef USE_DOTLOCK
- char b;
+ struct stat sb;
#endif
if ((fd = open (path, O_RDWR)) == -1)
return;
-
+
if (mx_lock_file (path, fd, 1, 0, 1) == -1)
{
close (fd);
@@ -310,11 +310,12 @@ void mx_unlink_empty (const char *path)
#ifdef USE_DOTLOCK
invoke_dotlock (path, DL_FL_UNLINK, 1);
#else
- if (read (fd, &b, 1) != 1)
+ if (fstat (fd, &sb) == 0 && sb.st_size == 0)
unlink (path);
#endif
mx_unlock_file (path, fd, 0);
+ close (fd);
}
/* try to figure out what type of mailbox ``path'' is