git: 9front

Download patch

ref: 4913865596229a6c402d6870db1259e82f3a2608
parent: 41357e0d28a94b5759e81d5c1833e281df07f23d
author: cinap_lenrek <cinap_lenrek@felloff.net>
date: Wed Oct 22 20:43:27 EDT 2014

lib9p: prevent files from being created in deleted directories (thanks BurnZeZ)

--- a/sys/src/lib9p/file.c
+++ b/sys/src/lib9p/file.c
@@ -191,6 +191,12 @@
 	}
 
 	wlock(fp);
+	if(fp->parent == nil){
+		wunlock(fp);
+		werrstr("create in deleted directory");
+		return nil;
+	}
+
 	/*
 	 * We might encounter blank spots along the
 	 * way due to deleted files that have not yet
--