shithub: unionfs

Download patch

ref: c7dd49d6a158e08c21985469e4c47209e428ee24
parent: df0f9b75a74c4fc2241bc1a85e605aa080d71bfd
author: kvik <[email protected]>
date: Tue May 14 16:29:30 EDT 2019

compress error checks

--- a/unionfs.c
+++ b/unionfs.c
@@ -458,8 +458,7 @@
 		st->dir = filereaddir(f);
 		st->idx = st->dir;
 	}else{
-		st->fd = open(f->path, i->mode);
-		if(st->fd < 0){
+		if((st->fd = open(f->path, i->mode)) < 0)
 			responderror(r);
 			return;
 		}
@@ -527,13 +526,11 @@
 	npath = mkpath(path, i->name, nil);
 	free(path);
 	st = emalloc(sizeof(*st));
-	st->fd = create(npath, i->mode, i->perm);
-	if(st->fd < 0){
+	if((st->fd = create(npath, i->mode, i->perm)) < 0)
 		responderror(r);
 		return;
 	}
-	d = dirfstat(st->fd);
-	if(d == nil){
+	if((d = dirfstat(st->fd)) == nil)
 		fstatefree(st);
 		responderror(r);
 		return;