From e80c7eb50b65ff7bc864fe551c24ac26c15f3e8d Mon Sep 17 00:00:00 2001 From: cinap_lenrek Date: Fri, 5 Jan 2024 07:07:53 +0000 Subject: [PATCH] cifs: fix rfork() race with shard pid variable --- sys/src/cmd/cifs/main.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sys/src/cmd/cifs/main.c b/sys/src/cmd/cifs/main.c index 2878537a1..6808a14c4 100644 --- a/sys/src/cmd/cifs/main.c +++ b/sys/src/cmd/cifs/main.c @@ -1325,10 +1325,11 @@ connected: if(Nshares == 0) fprint(2, "no available shares\n"); - if((Keeppid = rfork(RFPROC|RFMEM|RFNOTEG|RFFDG|RFNAMEG)) == 0){ + if((i = rfork(RFPROC|RFMEM|RFNOTEG|RFFDG|RFNAMEG)) == 0){ keepalive(); exits(nil); } + Keeppid = i; postmountsrv(&fs, svs, mtpt, MREPL|MCREATE); exits(nil); }