Merge: core: fix rmdir not reporting some errors