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/rio/fsys.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/rio/fsys.c')
-rw-r--r-- | sys/src/cmd/rio/fsys.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/sys/src/cmd/rio/fsys.c b/sys/src/cmd/rio/fsys.c index ebcdde17a..fca5c0469 100644 --- a/sys/src/cmd/rio/fsys.c +++ b/sys/src/cmd/rio/fsys.c @@ -105,7 +105,7 @@ int cexecpipe(int *p0, int *p1) { /* pipe the hard way to get close on exec */ - if(bind("#|", "/mnt/temp", MREPL) < 0) + if(bind("#|", "/mnt/temp", MREPL) == -1) return -1; *p0 = open("/mnt/temp/data", ORDWR); *p1 = open("/mnt/temp/data1", ORDWR|OCEXEC); @@ -235,11 +235,11 @@ filsysmount(Filsys *fs, int id) close(fs->sfd); /* close server end so mount won't hang if exiting */ sprint(buf, "%d", id); - if(mount(fs->cfd, -1, "/mnt/wsys", MREPL, buf) < 0){ + if(mount(fs->cfd, -1, "/mnt/wsys", MREPL, buf) == -1){ fprint(2, "mount failed: %r\n"); return -1; } - if(bind("/mnt/wsys", "/dev", MBEFORE) < 0){ + if(bind("/mnt/wsys", "/dev", MBEFORE) == -1){ fprint(2, "bind failed: %r\n"); return -1; } |