From ac88ce4f7f19be1aae1fdf390fa870b4be8dc3f5 Mon Sep 17 00:00:00 2001 From: cinap_lenrek Date: Sat, 2 May 2020 17:32:01 +0200 Subject: 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. --- sys/src/cmd/upas/imap4d/auth.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'sys/src/cmd/upas/imap4d') diff --git a/sys/src/cmd/upas/imap4d/auth.c b/sys/src/cmd/upas/imap4d/auth.c index 27174ddfb..651593eb5 100644 --- a/sys/src/cmd/upas/imap4d/auth.c +++ b/sys/src/cmd/upas/imap4d/auth.c @@ -29,11 +29,10 @@ enableforwarding(void) fd = open("/srv/ratify", ORDWR); if(fd < 0) return; - if(!mount(fd, -1, "/mail/ratify", MBEFORE, "")){ + if(mount(fd, -1, "/mail/ratify", MBEFORE, "") == -1){ close(fd); return; } - close(fd); strncpy(peer, remote, sizeof peer); peer[sizeof peer - 1] = 0; -- cgit v1.2.3