Commit Diff


commit - f987557cb3636bcd8ea1881625e724e77963d7db
commit + 47c9b8b8b3a15c444f6621e2680181eadc8db366
blob - 7e9b294776dba1e374f1db773d4b56fd9078cb72
blob + de3e8f6710a859dbc37ab900ca0f0c48f728cdf1
--- client.c
+++ client.c
@@ -868,6 +868,11 @@ twalk(struct np_msg_header *hdr, const uint8_t *data, 
 
 	if ((f = fid_by_id(fid)) == NULL) {
 		np_error(hdr->tag, "invalid fid");
+		return;
+	}
+
+	if (f->iomode != 0) {
+		np_error(hdr->tag, "fid already opened for I/O");
 		return;
 	}
 
@@ -892,11 +897,6 @@ twalk(struct np_msg_header *hdr, const uint8_t *data, 
 		return;
 	}
 
-	if (f->iomode != 0) {
-		np_error(hdr->tag, "fid already opened for I/O");
-		return;
-	}
-
 	if (f->qid->type != QTDIR) {
 		np_error(hdr->tag, "fid doesn't represent a directory");
 		return;