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/cpu.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/cpu.c')
-rw-r--r-- | sys/src/cmd/cpu.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/sys/src/cmd/cpu.c b/sys/src/cmd/cpu.c index 985325022..98080347d 100644 --- a/sys/src/cmd/cpu.c +++ b/sys/src/cmd/cpu.c @@ -331,7 +331,7 @@ remoteside(void) strcpy(buf, VERSION9P); if(fversion(fd, 64*1024, buf, sizeof buf) < 0) exits("fversion failed"); - if(mount(fd, -1, "/mnt/term", MCREATE|MREPL, "") < 0) + if(mount(fd, -1, "/mnt/term", MCREATE|MREPL, "") == -1) exits("mount failed"); close(fd); @@ -1180,7 +1180,7 @@ lclnoteproc(int netfd) return; case 0: close(pfd[0]); - if(mount(pfd[1], -1, "/dev", MBEFORE, "") < 0) + if(mount(pfd[1], -1, "/dev", MBEFORE, "") == -1) fprint(2, "cpu: can't mount note proc: %r\n"); close(pfd[1]); return; |