shithub: unionfs

Download patch

ref: 5ec5ff406eecab8fb2625d5b72d907571a76cea8
parent: 92cee7599e906f1a45666c7efaba6b3d1f15eee0
author: kvik <kvik@a-b.xyz>
date: Fri Jun 18 07:24:42 EDT 2021

Release mountpoint as soon as possible

--- a/unionfs.c
+++ b/unionfs.c
@@ -56,7 +56,6 @@
 	if(f->realpath) s_free(f->realpath);
 	if(f->fd != -1) close(f->fd);
 	if(f->dl) dirlistfree(f->dl);
-	if(f->mtpt) mtptfree(f->mtpt);
 	free(f);
 }
 
@@ -201,7 +200,9 @@
 			}
 		}
 		s_free(path);
-		if((f->fd = open(f->mtpt->path, T->mode)) == -1)
+		f->fd = open(f->mtpt->path, T->mode);
+		mtptfree(f->mtpt);
+		if(f->fd == -1)
 			goto error;
 	}else
 		if((f->fd = open(s_to_c(f->realpath), T->mode)) == -1)