If file is not found, try to unlock

This commit is contained in:
wbaumann 2009-06-07 18:26:53 +00:00
parent 8e213f10fe
commit e82cca6076
2 changed files with 15 additions and 5 deletions

View File

@ -10,6 +10,8 @@ ChangeLog for davfs2
* cache.c: * cache.c:
When upload fails temporarily: retry with When upload fails temporarily: retry with
increasing delays. increasing delays.
* webdav.c, dav_delete:
If file is not found, try to unlock.


2009-06-06 Werner Baumann (werner.baumann@onlinehome.de) 2009-06-06 Werner Baumann (werner.baumann@onlinehome.de)
* cache.c, dav_statfs: * cache.c, dav_statfs:

View File

@ -572,17 +572,25 @@ dav_delete(const char *path, time_t *expire)
if (ret) return ret; if (ret) return ret;
} }


struct ne_lock *lock = NULL;
char *spath = ne_path_escape(path); char *spath = ne_path_escape(path);
ret = ne_delete(session, spath); ret = ne_delete(session, spath);
ret = get_error(ret, "DELETE"); ret = get_error(ret, "DELETE");


if (ret == EACCES && lock_discover(spath, expire) == 0) { if ((ret == EACCES || ret == ENOENT) && locks) {
ret = ne_delete(session, spath); lock_discover(spath, expire);
ret = get_error(ret, "DELETE"); lock = lock_by_path(spath);
if (lock && ret == EACCES) {
ret = ne_delete(session, spath);
ret = get_error(ret, "DELETE");
} else if (lock) {
ne_unlock(session, lock);
ret = 0;
}
} }


if (!ret && locks && *expire) { if (!ret && locks) {
struct ne_lock *lock = lock_by_path(spath); lock = lock_by_path(spath);
if (lock) { if (lock) {
ne_lockstore_remove(locks, lock); ne_lockstore_remove(locks, lock);
ne_lock_destroy(lock); ne_lock_destroy(lock);