[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Lost] [PATCH] ! cdi/ext2: dot- und dotdot-Eintraege nicht als Ressourcen anlegen in Verzeichnissen, sonst klappt das mit dem Loeschen nicht, wenn die Listengroesse geprueft wird
---
src/modules/cdi/ext2/res.c | 9 ++++++++-
1 files changed, 8 insertions(+), 1 deletions(-)
diff --git a/src/modules/cdi/ext2/res.c b/src/modules/cdi/ext2/res.c
index cc7c331..50d7cc4 100644
--- a/src/modules/cdi/ext2/res.c
+++ b/src/modules/cdi/ext2/res.c
@@ -44,12 +44,19 @@ static int dir_fill_handler(ext2_dirent_t* dirent, void* priv)
struct ext2_fs_res* parent_res = (struct ext2_fs_res*) priv;
memset(res, 0, sizeof(*res));
- cdi_list_push(parent_res->res.children, res);
res->res.parent = (struct cdi_fs_res*) parent_res;
res->res.name = ext2_dir_alloc_name(dirent);
res->res.res = &ext2_fs_res;
res->inode_num = dirent->inode;
+
+ // Dot- und Dotdot-Eintraege wollen wir nicht
+ if (!strcmp(res->res.name, ".") || !strcmp(res->res.name, "..")) {
+ free(res->res.name);
+ free(res);
+ } else {
+ cdi_list_push(parent_res->res.children, res);
+ }
return 0;
}