shithub: riscv

Download patch

ref: 3bb7ad61aa05fca94fe508914ad5bbf4cf3a86f6
parent: 89e63156991a50263eb6481934ce1c40e4a13036
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