diff options
author | cinap_lenrek <cinap_lenrek@felloff.net> | 2021-05-01 19:58:58 +0200 |
---|---|---|
committer | cinap_lenrek <cinap_lenrek@felloff.net> | 2021-05-01 19:58:58 +0200 |
commit | ee289c241577a3553bfd73211cd81e137ab4fe40 (patch) | |
tree | 8f40ebfb2769de543c133120c5dbc468beddc9eb /sys/src/lib9p/share.c | |
parent | 57c21ae441d1b6af38ce310ffec87340488ed84b (diff) |
lib9p: remove Srv.srvfd, make postsrv() and threadpostsrv() return the mountable file descriptor, update documentation
Now that we have these new functions,
we can also make them return an error
instead of calling sysfatal() like
postmountsrv().
Remove the confusing Srv.srvfd, as it
is only temporarily used and return
it from postsrv() instead.
Diffstat (limited to 'sys/src/lib9p/share.c')
-rw-r--r-- | sys/src/lib9p/share.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/sys/src/lib9p/share.c b/sys/src/lib9p/share.c index ff73e9c3e..afa01c2f2 100644 --- a/sys/src/lib9p/share.c +++ b/sys/src/lib9p/share.c @@ -8,7 +8,7 @@ void postsharesrv(Srv *s, char *name, char *mtpt, char *desc) { char buf[80]; - int cfd; + int cfd, sfd; if(mtpt != nil && desc != nil){ snprint(buf, sizeof buf, "#σc/%s", mtpt); @@ -21,12 +21,13 @@ postsharesrv(Srv *s, char *name, char *mtpt, char *desc) } else cfd = -1; - postsrv(s, name); - + sfd = postsrv(s, name); + if(sfd < 0) + sysfatal("postsrv: %r"); if(cfd >= 0){ - if(fprint(cfd, "%d\n", s->srvfd) < 0) + if(fprint(cfd, "%d\n", sfd) < 0) sysfatal("write %s: %r", buf); close(cfd); } - close(s->srvfd); + close(sfd); } |