shithub: unionfs

Download patch

ref: 345a5b55e4275c8282150f8e635804e0fbe0339a
parent: 26945e0f33900835e4749f1205c733207f9e9731
author: kvik <[email protected]>
date: Fri Jun 4 06:53:40 EDT 2021

Don't sysfatal on bind error

--- a/unionfs.c
+++ b/unionfs.c
@@ -195,25 +195,22 @@
 			walk(path, branch[i].root, s_to_c(f->path));
 			if((d = dirstat(s_to_c(path))) != nil){
 				if(d->mode & DMDIR)
-				if(bind(s_to_c(path), f->mtpt->path, MAFTER) == -1)
-					sysfatal("bind: %r");
+					bind(s_to_c(path), f->mtpt->path, MAFTER);
 				free(d);
 			}
 		}
 		s_free(path);
-		if((f->fd = open(f->mtpt->path, T->mode)) < 0){
-			responderror(r);
-			goto done;
-		}
-	}else{
-		if((f->fd = open(s_to_c(f->realpath), T->mode)) < 0){
-			responderror(r);
-			goto done;
-		}
-	}
+		if((f->fd = open(f->mtpt->path, T->mode)) < 0)
+			goto error;
+	}else
+		if((f->fd = open(s_to_c(f->realpath), T->mode)) < 0)
+			goto error;
 	R->iounit = iounit(f->fd);
 	respond(r, nil);
-done:
+	srvacquire(&thefs);
+	return;
+error:
+	responderror(r);
 	srvacquire(&thefs);
 }