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

This commit is contained in:
cinap_lenrek 2016-07-24 03:24:42 +02:00
parent 8173223f43
commit 409babb990
2 changed files with 2 additions and 2 deletions

View file

@ -1436,7 +1436,7 @@ buftochan(char *p)
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");

View file

@ -1872,7 +1872,7 @@ buftochan(char *p)
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;
}