shithub: riscv

Download patch

ref: dea290578377f1d0a8691072557e8653f27b14a9
parent: 2401794cffea1671931bd2e34645756c9689e8eb
author: cinap_lenrek <cinap_lenrek@felloff.net>
date: Fri Oct 4 14:52:53 EDT 2019

lib9p: fix listensrv() filedescriptor leaks

--- a/sys/src/lib9p/listen.c
+++ b/sys/src/lib9p/listen.c
@@ -44,11 +44,13 @@
 			break;
 		}
 		
-		data = accept(ctl, ndir);
+		data = accept(nctl, ndir);
 		if(data < 0){
 			fprint(2, "%s: accept %s: %r\n", argv0, ndir);
+			close(nctl);
 			continue;
 		}
+		close(nctl);
 
 		s = emalloc9p(sizeof *s);
 		*s = *os;