agendafs

A filesystem for your calendar.

git clone git://mccd.space/agendafs
commit 26ef6131300f4be4f8206c07eb4246a7399ffe2d
parent 17d8e83e7621a4613859ade5b7cd93bed7cdeb06
Author: Marc Coquand <marc@coquand.email>
Date:   Tue, 29 Jul 2025 00:17:33 +0200

Code clarity

Diffstat:
Mmain.c | 17+++++++++--------
1 file changed, 9 insertions(+), 8 deletions(-)
diff --git a/main.c b/main.c
@@ -316,14 +316,15 @@ fuse_rename(const char *old, const char *new, unsigned int flags)
 	int res = 0;
 
 	struct tree_node *existing_node = get_node_by_path(mreg, new);
-	if (existing_node && node_has_children(existing_node)) {
-		res = -ENOTEMPTY;
-		goto cleanup_return;
-	}
-
-	if (existing_node && delete_vdir_entry(mreg, existing_node) != 0) {
-		res = -EIO;
-		goto cleanup_return;
+	if (existing_node) {
+		if (node_has_children(existing_node)) {
+			res = -ENOTEMPTY;
+			goto cleanup_return;
+		}
+		if (delete_vdir_entry(mreg, existing_node) != 0) {
+			res = -EIO;
+			goto cleanup_return;
+		}
 	}
 
 	res = do_agenda_rename(mreg, old, new);