git: 9front

Download patch

ref: bbf10e9a52bbfbfb7dfcda043b0383866c72931e
parent: 1dc9c1235a9b8651fd747b60797eb4382d2552d3
author: cinap_lenrek <cinap_lenrek@felloff.net>
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;
 }
 
--