From 0de3396a3db618f561daf7ada8ff1dfc40d21bc2 Mon Sep 17 00:00:00 2001 From: wbaumann Date: Wed, 26 Aug 2009 19:40:58 +0000 Subject: [PATCH] fix EBADF when coda closes directory --- ChangeLog | 5 +++++ THANKS | 1 + src/cache.c | 4 +++- 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 9c34d6e..dedf4bd 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,6 +1,11 @@ ChangeLog for davfs2 -------------------- +2009-08-26 Werner Baumann (werner.baumann@onlinehome.de) + * cache.c, dav_close: + In call to get_file_handle set parameter accmode + to O_RDWR for directories (to avoid EBADF with coda). + 2009-07-17 Werner Baumann (werner.baumann@onlinehome.de) * webdav.c, prop_result: Remove double slashes from path. diff --git a/THANKS b/THANKS index 7ae789b..17ef89c 100644 --- a/THANKS +++ b/THANKS @@ -54,6 +54,7 @@ Arkadiusz Miskiewicz Maik Nijhuis Joseph Wayne Norton Tim Olsen +Jan Ortgies Joe Orton Panu Outinen Tero Pelander diff --git a/src/cache.c b/src/cache.c index d804d35..9dd696d 100644 --- a/src/cache.c +++ b/src/cache.c @@ -836,7 +836,9 @@ dav_close(dav_node *node, int fd, int flags, pid_t pid, pid_t pgid) if (debug) syslog(LOG_MAKEPRI(LOG_DAEMON, LOG_DEBUG), " close %s", node->path); - dav_handle *fh = get_file_handle(node, fd, flags & O_ACCMODE, pid, pgid); + dav_handle *fh = get_file_handle(node, fd, + is_dir(node) ? O_RDWR : flags & O_ACCMODE, + pid, pgid); if (!fh) return EBADF;