summaryrefslogtreecommitdiff
path: root/sys/src/libauth
diff options
context:
space:
mode:
authorcinap_lenrek <cinap_lenrek@felloff.net>2020-05-02 17:32:01 +0200
committercinap_lenrek <cinap_lenrek@felloff.net>2020-05-02 17:32:01 +0200
commitac88ce4f7f19be1aae1fdf390fa870b4be8dc3f5 (patch)
tree47df6acf41dd8d2dc607b89af9d4667935d0c952 /sys/src/libauth
parent7ff6ea0f70307d4b82e6df69eb1310a6e27aa4ad (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/libauth')
-rw-r--r--sys/src/libauth/newns.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/sys/src/libauth/newns.c b/sys/src/libauth/newns.c
index 172692cc2..fd5d6cb59 100644
--- a/sys/src/libauth/newns.c
+++ b/sys/src/libauth/newns.c
@@ -184,7 +184,7 @@ nsop(char *fn, int argc, char *argv[], AuthRpc *rpc)
}else if(strcmp(argv0, "clear") == 0 && argc == 0){
rfork(RFCNAMEG);
}else if(strcmp(argv0, "bind") == 0 && argc == 2){
- if(bind(argv[0], argv[1], flags) < 0 && newnsdebug)
+ if(bind(argv[0], argv[1], flags) == -1 && newnsdebug)
fprint(2, "%s: bind: %s %s: %r\n", fn, argv[0], argv[1]);
}else if(strcmp(argv0, "unmount") == 0){
if(argc == 1)
@@ -199,10 +199,10 @@ nsop(char *fn, int argc, char *argv[], AuthRpc *rpc)
return 0;
}
if(argc == 2){
- if(famount(fd, rpc, argv[1], flags, "") < 0 && newnsdebug)
+ if(famount(fd, rpc, argv[1], flags, "") == -1 && newnsdebug)
fprint(2, "%s: mount: %s %s: %r\n", fn, argv[0], argv[1]);
}else if(argc == 3){
- if(famount(fd, rpc, argv[1], flags, argv[2]) < 0 && newnsdebug)
+ if(famount(fd, rpc, argv[1], flags, argv[2]) == -1 && newnsdebug)
fprint(2, "%s: mount: %s %s %s: %r\n", fn, argv[0], argv[1], argv[2]);
}
close(fd);