diff options
author | cinap_lenrek <cinap_lenrek@felloff.net> | 2020-05-02 17:32:01 +0200 |
---|---|---|
committer | cinap_lenrek <cinap_lenrek@felloff.net> | 2020-05-02 17:32:01 +0200 |
commit | ac88ce4f7f19be1aae1fdf390fa870b4be8dc3f5 (patch) | |
tree | 47df6acf41dd8d2dc607b89af9d4667935d0c952 /sys/src/cmd/ip/ftpd.c | |
parent | 7ff6ea0f70307d4b82e6df69eb1310a6e27aa4ad (diff) |
make bind(2) error handling consistent
The mount() and bind() syscalls return -1 on error,
and the mountid sequence number on success.
The manpage states that the mountid sequence number
is a positive integer, but the kernels implementation
currently uses a unsigned 32-bit integer and does not
guarantee that the mountid will not become negative.
Most code just cares about the error, so test for
the -1 error value only.
Diffstat (limited to 'sys/src/cmd/ip/ftpd.c')
-rw-r--r-- | sys/src/cmd/ip/ftpd.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/sys/src/cmd/ip/ftpd.c b/sys/src/cmd/ip/ftpd.c index df91065bb..f4ebbf68b 100644 --- a/sys/src/cmd/ip/ftpd.c +++ b/sys/src/cmd/ip/ftpd.c @@ -412,10 +412,10 @@ transfer(char *cmd, char *a1, char *a2, char *a3, int image) if(isnone){ fd = open("#s/boot", ORDWR); if(fd < 0 - || bind("#/", "/", MAFTER) < 0 - || amount(fd, "/bin", MREPL, "") < 0 - || bind("#c", "/dev", MAFTER) < 0 - || bind(bindir, "/bin", MREPL) < 0) + || bind("#/", "/", MAFTER) == -1 + || amount(fd, "/bin", MREPL, "") == -1 + || bind("#c", "/dev", MAFTER) == -1 + || bind(bindir, "/bin", MREPL) == -1) exits("building name space"); close(fd); } @@ -810,12 +810,12 @@ mountnet(void) rv = 0; - if(bind("#/", "/", MAFTER) < 0){ + if(bind("#/", "/", MAFTER) == -1){ logit("can't bind #/ to /: %r"); return reply("500 can't bind #/ to /: %r"); } - if(bind(nci->spec, "/net", MBEFORE) < 0){ + if(bind(nci->spec, "/net", MBEFORE) == -1){ logit("can't bind %s to /net: %r", nci->spec); rv = reply("500 can't bind %s to /net: %r", nci->spec); unmount("#/", "/"); |