git: 9front

Download patch

ref: 1d7205564c7e6364eacb1e68b5060a88b93d25a6
parent: cacd1d6d6a921ca53ac54f9ed7246c95cbfaa566
author: cinap_lenrek <cinap_lenrek@felloff.net>
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);
--