summaryrefslogtreecommitdiff
path: root/sys/src/cmd/cwfs/9p2.c
diff options
context:
space:
mode:
authorcinap_lenrek <cinap_lenrek@gmx.de>2012-07-13 15:09:39 +0200
committercinap_lenrek <cinap_lenrek@gmx.de>2012-07-13 15:09:39 +0200
commit8e11ff283f1e7c36b23e6e52c2ab0ca12a7713f9 (patch)
tree21ae354f7121d196046b6b9c36a18232afb38e43 /sys/src/cmd/cwfs/9p2.c
parent53f5bdfd06cce8093de005b8d706b752d3567cfa (diff)
cwfs: make /srv/cwfs.cmd redable to receive command output
before, cwfs would print everything to /dev/cons. this change will redirect the output of commands to the /srv/cwfs.cmd pipe so one can use: con -C /srv/cwfs.cmd and not have the fish for the output in /dev/kmesg. use standard error (/dev/cons) for unsolicited messages as there is not always a reader on the command file.
Diffstat (limited to 'sys/src/cmd/cwfs/9p2.c')
-rw-r--r--sys/src/cmd/cwfs/9p2.c21
1 files changed, 10 insertions, 11 deletions
diff --git a/sys/src/cmd/cwfs/9p2.c b/sys/src/cmd/cwfs/9p2.c
index efcdef37c..aeb7d6190 100644
--- a/sys/src/cmd/cwfs/9p2.c
+++ b/sys/src/cmd/cwfs/9p2.c
@@ -204,7 +204,7 @@ authorize(Chan* chan, Fcall* f)
if(strcmp(f->uname, "none") == 0){
uid = strtouid(f->uname);
if(db)
- print("permission granted to none: uid %s = %d\n",
+ fprint(2, "permission granted to none: uid %s = %d\n",
f->uname, uid);
return uid;
}
@@ -212,7 +212,7 @@ authorize(Chan* chan, Fcall* f)
if(noauth || wstatallow){
uid = strtouid(f->uname);
if(db)
- print("permission granted by noauth uid %s = %d\n",
+ fprint(2, "permission granted by noauth uid %s = %d\n",
f->uname, uid);
return uid;
}
@@ -220,7 +220,7 @@ authorize(Chan* chan, Fcall* f)
af = filep(chan, f->afid, 0);
if(af == nil){
if(db)
- print("authorize: af == nil\n");
+ fprint(2, "authorize: af == nil\n");
return -1;
}
@@ -228,7 +228,7 @@ authorize(Chan* chan, Fcall* f)
authread(af, nil, 0);
uid = af->uid;
if(db)
- print("authorize: uid is %d\n", uid);
+ fprint(2, "authorize: uid is %d\n", uid);
qunlock(af);
return uid;
}
@@ -1707,18 +1707,17 @@ serve9p2(Msgbuf* mb)
* 1 return means i dealt with it, including error
* replies.
*/
- if(convM2S(mb->data, mb->count, &f) != mb->count)
-{
-print("didn't like %d byte message\n", mb->count);
+ if(convM2S(mb->data, mb->count, &f) != mb->count){
+ fprint(2, "didn't like %d byte message\n", mb->count);
return 0;
-}
+ }
type = f.type;
if(type < Tversion || type >= Tmax || (type & 1) || type == Terror)
return 0;
chan = mb->chan;
if(CHAT(chan))
- print("9p2: f %F\n", &f);
+ fprint(2, "9p2: f %F\n", &f);
r.type = type+1;
r.tag = f.tag;
error = 0;
@@ -1786,7 +1785,7 @@ print("didn't like %d byte message\n", mb->count);
r.ename = errstr9p[error];
}
if(CHAT(chan))
- print("9p2: r %F\n", &r);
+ fprint(2, "9p2: r %F\n", &r);
rmb = mballoc(chan->msize, chan, Mbreply2);
n = convS2M(&r, rmb->data, chan->msize);
@@ -1812,7 +1811,7 @@ print("didn't like %d byte message\n", mb->count);
r.ename = ename;
n = convS2M(&r, rmb->data, chan->msize);
}
- print("%s\n", r.ename);
+ fprint(2, "%s\n", r.ename);
if(n == 0){
/*
* What to do here, the failure notification failed?