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:
When upload fails temporarily: retry with
increasing delays.
* webdav.c, dav_delete:
If file is not found, try to unlock.

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

View File

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

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

if (ret == EACCES && lock_discover(spath, expire) == 0) {
ret = ne_delete(session, spath);
ret = get_error(ret, "DELETE");
if ((ret == EACCES || ret == ENOENT) && locks) {
lock_discover(spath, expire);
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) {
struct ne_lock *lock = lock_by_path(spath);
if (!ret && locks) {
lock = lock_by_path(spath);
if (lock) {
ne_lockstore_remove(locks, lock);
ne_lock_destroy(lock);