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/auth | |
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/auth')
-rw-r--r-- | sys/src/cmd/auth/factotum/util.c | 2 | ||||
-rw-r--r-- | sys/src/cmd/auth/keyfs.c | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/sys/src/cmd/auth/factotum/util.c b/sys/src/cmd/auth/factotum/util.c index d7a650708..42e40b281 100644 --- a/sys/src/cmd/auth/factotum/util.c +++ b/sys/src/cmd/auth/factotum/util.c @@ -14,7 +14,7 @@ bindnetcs(void) if(access("/net/cs", AEXIST) < 0){ if((srvfd = open("#s/cs", ORDWR)) >= 0){ - if(mount(srvfd, -1, "/net", MBEFORE, "") >= 0) + if(mount(srvfd, -1, "/net", MBEFORE, "") != -1) return 0; close(srvfd); } diff --git a/sys/src/cmd/auth/keyfs.c b/sys/src/cmd/auth/keyfs.c index efab7e4c0..a0d421535 100644 --- a/sys/src/cmd/auth/keyfs.c +++ b/sys/src/cmd/auth/keyfs.c @@ -212,7 +212,7 @@ main(int argc, char *argv[]) error("fork"); default: close(p[1]); - if(mount(p[0], -1, mntpt, MREPL|MCREATE, "") < 0) + if(mount(p[0], -1, mntpt, MREPL|MCREATE, "") == -1) error("can't mount: %r"); exits(0); } |