From: Charles Manning Date: Thu, 13 May 2010 02:29:16 +0000 (+1200) Subject: yaffs Fix incorrect handling of deletion flag X-Git-Tag: pre-name-change~65 X-Git-Url: http://www.aleph1.co.uk/gitweb/?p=yaffs2.git;a=commitdiff_plain;h=401f9eb48ce20b18902ad9a4a8039d43e363d2ec yaffs Fix incorrect handling of deletion flag Move the reading of the deleted flag so that it picks up any changes. Notw we need a value on the stack because the object might get freed and we don't want to access a hanging pointer. Signed-off-by: Charles Manning --- diff --git a/yaffs_guts.c b/yaffs_guts.c index d55aa95..9509dd4 100644 --- a/yaffs_guts.c +++ b/yaffs_guts.c @@ -5624,7 +5624,7 @@ static int yaffs_UnlinkFileIfNeeded(yaffs_Object *in) int yaffs_DeleteFile(yaffs_Object *in) { int retVal = YAFFS_OK; - int deleted = in->deleted; + int deleted; /* Need to cache value on stack if in is freed */ yaffs_Device *dev = in->myDev; if (dev->param.disableSoftDelete || dev->param.isYaffs2) @@ -5637,6 +5637,8 @@ int yaffs_DeleteFile(yaffs_Object *in) if (!in->unlinked) retVal = yaffs_UnlinkFileIfNeeded(in); + deleted = in->deleted; + if (retVal == YAFFS_OK && in->unlinked && !in->deleted) { in->deleted = 1; deleted = 1;