agendafs

A filesystem for your calendar.

git clone git://mccd.space/agendafs
commit 54c48bdfb2e6e9e59edd46254b40769de5f69bcd
parent 24863650443d3395360eb8f7c57c68177db96984
Author: Marc Coquand <marc@coquand.email>
Date:   Fri, 15 Aug 2025 13:28:03 +0200

Proper check if entry is directory

Closes: https://todo.sr.ht/~marcc/agendafs/35

Diffstat:
Mfuse_node.c | 20+++-----------------
1 file changed, 3 insertions(+), 17 deletions(-)
diff --git a/fuse_node.c b/fuse_node.c
@@ -576,8 +576,7 @@ insert_fuse_node_to_path(memory_region *mreg, const char *fuse_path,
 	icalcomponent *parent_ics =
 	    get_icalcomponent_from_node(mreg, parent_node);
 
-	if (!is_root_node(parent_node) ||
-	    (parent_ics && !node_is_directory(mreg, parent_node, parent_ics))) {
+	if (!node_is_directory(mreg, parent_node, parent_ics)) {
 		LOG("Parent is not a directory");
 		return -ENOTDIR;
 	}
@@ -625,21 +624,8 @@ create_entry_from_fuse(memory_region *mreg, const char *fuse_path,
 
 	struct tree_node *new_node = create_fuse_node(new_entry);
 
-	int status =
-	    insert_fuse_node_to_path(mreg, fuse_path, new_node, new_component);
-
-	if (status != 0) {
-		return -ENOENT;
-	}
-
-	if (write_ical_file(mreg, new_node, new_component) != 0) {
-		LOG("Write to entry failed");
-		delete_fuse_node(new_node);
-		return -EIO;
-	}
-
-	LOG("FILE CREATED");
-	return 0;
+	return insert_fuse_node_to_path(mreg, fuse_path, new_node,
+					new_component);
 }
 
 int