Mercurial > nomad > experimental
changeset 1273:75e654e85cab
objstore: return ENOTDIR/EISDIR in unlink and rmdir
It is a bit unfortunate that we have to do this check so deep inside a
transaction, but there doesn't appear to be an easy way around it.
Signed-off-by: Josef 'Jeff' Sipek <jeffpc@josefsipek.net>
author | Josef 'Jeff' Sipek <jeffpc@josefsipek.net> |
---|---|
date | Sat, 17 Dec 2022 20:15:05 -0500 |
parents | a3989958f5fc |
children | 7f43822eef34 |
files | src/objstore/obj_dir_unlink.c |
diffstat | 1 files changed, 3 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/src/objstore/obj_dir_unlink.c Sat Dec 17 20:11:50 2022 -0500 +++ b/src/objstore/obj_dir_unlink.c Sat Dec 17 20:15:05 2022 -0500 @@ -67,7 +67,9 @@ VERIFY3U(j, <, block->entries[i].dirent.ntgts); VERIFY(!block->entries[i].tgts[j].deleted); - if (block->entries[i].tgts[j].type == NDIRENT_TYPE_DIR) + if (rmdir && (block->entries[i].tgts[j].type != NDIRENT_TYPE_DIR)) + return -ENOTDIR; + if (!rmdir && (block->entries[i].tgts[j].type == NDIRENT_TYPE_DIR)) return -EISDIR; /* update the target */