diff options
author | amavect <amavect@gmail.com> | 2021-08-14 19:50:23 +0000 |
---|---|---|
committer | amavect <amavect@gmail.com> | 2021-08-14 19:50:23 +0000 |
commit | e524e8d65a7573c46d7beb49e77bfc2d55a5563d (patch) | |
tree | 2427bb74097741eac6100ba5a85dc85abc6dc939 /sys/src/cmd/exportfs/oexportfs.c | |
parent | 4e9f39a3ec0712542af0d035c79b3bf0eb2f2cd3 (diff) |
exportfs: make -d log to stderr
exportfs -d logs 9p traffic to /tmp/exportdb.
-f allows writing to a different file.
exportfs silently continues if it doesn't have
permissions to create or write to /tmp/exportdb.
These are poor behaviors.
A better default is to write to stderr, since it
is 9P debug info that is better immediately printed,
and not user info that is better handled by syslog().
As a result, -f is obsolete and thus removed.
Redirect responsibility is now on rc.
As a side effect, rc will fail if it doesn't
have permissions to write.
exportfs(4) is updated to reflect all changes
and with a better Synopsis.
Diffstat (limited to 'sys/src/cmd/exportfs/oexportfs.c')
-rw-r--r-- | sys/src/cmd/exportfs/oexportfs.c | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/sys/src/cmd/exportfs/oexportfs.c b/sys/src/cmd/exportfs/oexportfs.c index c6683a174..e9fa819c7 100644 --- a/sys/src/cmd/exportfs/oexportfs.c +++ b/sys/src/cmd/exportfs/oexportfs.c @@ -59,7 +59,7 @@ filter(int fd, char *cmd, char *host) strecpy(strrchr(addr, '!'), addr+sizeof(addr), s); } - DEBUG(DFD, "filter: %s\n", addr); + DEBUG(2, "filter: %s\n", addr); snprint(buf, sizeof(buf), "%s", cmd); argc = tokenize(buf, argv, nelem(argv)-3); @@ -256,7 +256,7 @@ main(int argc, char **argv) if(dbg) { n = create(dbfile, OWRITE|OTRUNC, 0666); - dup(n, DFD); + dup(n, 2); close(n); } @@ -265,7 +265,7 @@ main(int argc, char **argv) usage(); } - DEBUG(DFD, "%s: started\n", argv0); + DEBUG(2, "%s: started\n", argv0); rfork(RFNOTEG|RFREND); @@ -289,10 +289,10 @@ main(int argc, char **argv) if(chdir(srv) < 0) { ebuf[0] = '\0'; errstr(ebuf, sizeof ebuf); - DEBUG(DFD, "chdir(\"%s\"): %s\n", srv, ebuf); + DEBUG(2, "chdir(\"%s\"): %s\n", srv, ebuf); mounterror(ebuf); } - DEBUG(DFD, "invoked as server for %s", srv); + DEBUG(2, "invoked as server for %s", srv); strncpy(buf, srv, sizeof buf); } else { @@ -301,22 +301,22 @@ main(int argc, char **argv) if(n < 0) { errstr(buf, sizeof buf); fprint(0, "read(0): %s\n", buf); - DEBUG(DFD, "read(0): %s\n", buf); + DEBUG(2, "read(0): %s\n", buf); exits(buf); } buf[n] = 0; if(chdir(buf) < 0) { errstr(ebuf, sizeof ebuf); fprint(0, "chdir(%d:\"%s\"): %s\n", n, buf, ebuf); - DEBUG(DFD, "chdir(%d:\"%s\"): %s\n", n, buf, ebuf); + DEBUG(2, "chdir(%d:\"%s\"): %s\n", n, buf, ebuf); exits(ebuf); } } - DEBUG(DFD, "\niniting root\n"); + DEBUG(2, "\niniting root\n"); initroot(); - DEBUG(DFD, "%s: %s\n", argv0, buf); + DEBUG(2, "%s: %s\n", argv0, buf); if(srv == nil && srvfd == -1 && write(0, "OK", 2) != 2) fatal("open ack write"); @@ -436,7 +436,7 @@ main(int argc, char **argv) if(convM2S(r->buf, n, &r->work) != n) fatal("convM2S format error"); - DEBUG(DFD, "%F\n", &r->work); + DEBUG(2, "%F\n", &r->work); (fcalls[r->work.type])(r); } io(); |