shithub: riscv

Download patch

ref: 409babb990a4740e5274b22d65cb4df451a277fd
parent: 8173223f439546685f0cc4471efc9a9d12fccf4c
author: cinap_lenrek <[email protected]>
date: Sat Jul 23 23:24:42 EDT 2016

devtls, devssl: make sure channel has ORDWR mode and is not a mount chan on fdtochan()

--- a/sys/src/9/port/devssl.c
+++ b/sys/src/9/port/devssl.c
@@ -1436,7 +1436,7 @@
 	fd = strtoul(p, 0, 0);
 	if(fd < 0)
 		error(Ebadarg);
-	c = fdtochan(fd, -1, 0, 1);	/* error check and inc ref */
+	c = fdtochan(fd, ORDWR, 1, 1);	/* error check and inc ref */
 	if(devtab[c->type] == &ssldevtab){
 		cclose(c);
 		error("cannot ssl encrypt devssl files");
--- a/sys/src/9/port/devtls.c
+++ b/sys/src/9/port/devtls.c
@@ -1872,7 +1872,7 @@
 	fd = strtoul(p, 0, 0);
 	if(fd < 0)
 		error(Ebadarg);
-	c = fdtochan(fd, -1, 0, 1);	/* error check and inc ref */
+	c = fdtochan(fd, ORDWR, 1, 1);	/* error check and inc ref */
 	return c;
 }