posix: better handle empty directories (those without . and .. entries)