summaryrefslogtreecommitdiff
path: root/sys/src/cmd/sam/mesg.c
diff options
context:
space:
mode:
authorcinap_lenrek <cinap_lenrek@gmx.de>2012-04-24 06:57:02 +0200
committercinap_lenrek <cinap_lenrek@gmx.de>2012-04-24 06:57:02 +0200
commit8562240e8c0222a2bf5f666218cbce01bfae0f62 (patch)
tree577e4ceea38d2d59185b0c085ab47c05e7c28aba /sys/src/cmd/sam/mesg.c
parent7e4d9a4bfa2148c07930dd45b4e7d3071ff6180e (diff)
fix more fd <= 0 bugs
Diffstat (limited to 'sys/src/cmd/sam/mesg.c')
-rw-r--r--sys/src/cmd/sam/mesg.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/sys/src/cmd/sam/mesg.c b/sys/src/cmd/sam/mesg.c
index e9234a7ad..7d390fd13 100644
--- a/sys/src/cmd/sam/mesg.c
+++ b/sys/src/cmd/sam/mesg.c
@@ -86,11 +86,12 @@ char *tname[] = {
void
journal(int out, char *s)
{
- static int fd = 0;
+ static int fd = -1;
- if(fd <= 0)
+ if(fd < 0)
fd = create("/tmp/sam.out", 1, 0666L);
- fprint(fd, "%s%s\n", out? "out: " : "in: ", s);
+ if(fd >= 0)
+ fprint(fd, "%s%s\n", out? "out: " : "in: ", s);
}
void