summaryrefslogtreecommitdiff
path: root/sys/src/games
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/games
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/games')
-rw-r--r--sys/src/games/doom/i_sound.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/sys/src/games/doom/i_sound.c b/sys/src/games/doom/i_sound.c
index 50f1f118e..37873b133 100644
--- a/sys/src/games/doom/i_sound.c
+++ b/sys/src/games/doom/i_sound.c
@@ -484,7 +484,7 @@ void I_PlaySong(musicinfo_t *m, int loop)
sysfatal("write: %r");
if(seek(0, 0, 0) != 0)
sysfatal("seek: %r");
- if(bind("/fd/1", "/dev/audio", MREPL) < 0)
+ if(bind("/fd/1", "/dev/audio", MREPL) == -1)
sysfatal("bind: %r");
while(loop && fork() > 0){
if(waitpid() < 0 || write(1, "", 0) < 0)