shithub: riscv

Download patch

ref: 093eaec219c13b191968271a4d366669621b4f5f
parent: 95524b1cdd24091d8d677d4c7a0bb8492f1a7961
author: cinap_lenrek <[email protected]>
date: Tue Jul 19 18:10:52 EDT 2016

kernel: dont pprint() into 9p channels

when fd 2 (stderr) points to a mount channel, dont
cause protocol confusion by dumping error strings
into it.

--- a/sys/src/9/port/devcons.c
+++ b/sys/src/9/port/devcons.c
@@ -302,7 +302,7 @@
 		return 0;
 
 	c = up->fgrp->fd[2];
-	if(c==nil || (c->mode!=OWRITE && c->mode!=ORDWR))
+	if(c==nil || (c->flag&CMSG)!=0 || (c->mode!=OWRITE && c->mode!=ORDWR))
 		return 0;
 	n = snprint(buf, sizeof buf, "%s %lud: ", up->text, up->pid);
 	va_start(arg, fmt);