shithub: unionfs

Download patch

ref: 016441e84b12c4b48304ac0ab814a802bf60516e
parent: d2010111e3dd109a44dc91de16eadb82ddd1dd5e
author: kvik <kvik@a-b.xyz>
date: Wed May 15 17:07:59 EDT 2019

simplify the union walk loop

--- a/unionfs.c
+++ b/unionfs.c
@@ -338,15 +338,16 @@
 	}
 	for(u = unionlist->next; u != unionlist; u = u->next){
 		path = mkpath(u->root, np, nil);
-		if(d = dirstat(path)){
-			f = filenew(d);
-			free(d);
-			f->fspath = np;
-			f->path = path;
-			filefree(p);
-			return f;
+		if((d = dirstat(path)) == nil){
+			free(path);
+			continue;
 		}
-		free(path);
+		f = filenew(d);
+		free(d);
+		f->fspath = np;
+		f->path = path;
+		filefree(p);
+		return f;
 	}
 	free(np);
 	return nil;