shithub: front

Download patch

ref: c0e343a40ce825ff4ee88a766152fd6a5f444d14
parent: f8d9a6b94708bd093c26066786d00b70be28fd59
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)
--