shithub: gefs

Download patch

ref: 31d7c618756cbef356b68828795d9042cd614507
parent: d79d058a950abf6ab6985cc7f44e851fa88aa4b5
author: Ori Bernstein <[email protected]>
date: Mon Dec 6 00:27:39 EST 2021

fs: require 9p version message before we talk to the world

--- a/fs.c
+++ b/fs.c
@@ -1097,7 +1097,7 @@
 void
 runfs(void *pfd)
 {
-	int fd, msgmax;
+	int fd, msgmax, versioned;
 	char err[128];
 	QLock *wrlk;
 	Fcall r;
@@ -1105,6 +1105,7 @@
 
 	fd = (uintptr)pfd;
 	msgmax = Max9p;
+	versioned = 0;
 	if((wrlk = mallocz(sizeof(QLock), 1)) == nil)
 		fshangup(fd, "alloc wrlk: %r");
 	while(1){
@@ -1116,13 +1117,12 @@
 			fshangup(fd, "invalid message: %r");
 			return;
 		}
-/*
 		if(m->type != Tversion && !versioned){
 			fshangup(fd, "version required");
 			return;
 		}
-*/
 		m->wrlk = wrlk;
+		versioned = 1;
 		dprint("← %F\n", &m->Fcall);
 		switch(m->type){
 		/* sync setup */