From 0d1b39dd394760cfb4263072d9e33f577c8f1c56 Mon Sep 17 00:00:00 2001 From: mazze Date: Sun, 5 Jan 2014 14:19:54 +0000 Subject: [PATCH] DeleteFile() failes on locked files => do the unlocking directly after ParentDir(). Unlocking resets the error code => remember error code before unlocking and reset it. That should fix the problem which was reported here: http://aros-exec.org/modules/newbb/viewtopic.php?post_id=85783#forumpost85783 git-svn-id: https://svn.aros.org/svn/aros/trunk/AROS@48682 fb15a70f-31f2-0310-bbcc-cdcc74a49acc --- workbench/libs/icon/deletediskobject.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/workbench/libs/icon/deletediskobject.c b/workbench/libs/icon/deletediskobject.c index 71301cda85..11791626c0 100644 --- a/workbench/libs/icon/deletediskobject.c +++ b/workbench/libs/icon/deletediskobject.c @@ -48,9 +48,10 @@ UBYTE * infofilename; BOOL success = FALSE; BPTR lock, parent; + LONG ioerr; if (!(infofilename = (UBYTE*)AllocVec (strlen(name) + 6, - MEMF_ANY | MEMF_CLEAR) + MEMF_ANY | MEMF_CLEAR) ) ) return (FALSE); @@ -61,14 +62,16 @@ lock = Lock(infofilename, SHARED_LOCK); if (lock) { parent = ParentDir(lock); + UnLock(lock); // DeleteFile() fails on locked files if (parent) { success = DeleteFile (infofilename); if (success && WorkbenchBase) { UpdateWorkbench(FilePart(name), parent, UPDATEWB_ObjectRemoved); } + ioerr = IoErr(); // UnLock() resets error UnLock(parent); + SetIoErr(ioerr); } - UnLock(lock); } FreeVec (infofilename); -- 2.11.4.GIT