git: 9front

Download patch

ref: abb3ca754c72f680f853d484409032d17017cde5
parent: 88a35c80586c489b991dddb4299f72c9c4ec6168
author: Ori Bernstein <ori@eigenstate.org>
date: Mon May 26 21:10:02 EDT 2025

gefs: don't allow removal of locked files

--- a/sys/src/cmd/gefs/fs.c
+++ b/sys/src/cmd/gefs/fs.c
@@ -1914,6 +1914,8 @@
 	}
 	if(f->dent->gone)
 		error(Ephase);
+	if((f->dent->qid.type & QTEXCL) && f->dent->ref != 1)
+		error(Elocked);
 	/*
 	 * we need a double check that the file is in the tree
 	 * here, because the walk to the fid is done in a reader
@@ -2005,8 +2007,7 @@
 	}
 	if(f->dent->gone)
 		error(Ephase);
-	if(f->dent->qid.type & QTEXCL)
-	if(f->dent->ref != 1)
+	if((f->dent->qid.type & QTEXCL) && f->dent->ref != 1)
 		error(Elocked);
 	if(m->mode & ORCLOSE)
 		if((e = candelete(f)) != nil)
--