shithub: riscv

Download patch

ref: 30dcf55ee221b986aee6d428b4da431f6174c66b
parent: 7a225e5331749e1c656661f7c1c5cc2767aa13d8
author: Ori Bernstein <ori@eigenstate.org>
date: Sat Jul 30 12:09:27 EDT 2022

bind, mount: stop returning mount id

The mount ID is a sequence number in a 32 bit integer, which means that
it can't be unique. This is largely harmless, because there is no way to
use the mount id, beyond checking if it's negative.

However, there's no overflow check, so the mount ID can wrap negative,
which will break error checks on mount calls.

Because it's useless, let's just stop returning it.

--- a/sys/man/2/bind
+++ b/sys/man/2/bind
@@ -224,8 +224,7 @@
 .IR mnt (3),
 .IR srv (3)
 .SH DIAGNOSTICS
-The return value is a positive integer (a unique sequence number) for
-success, -1 for failure.
+The return value is 0 for success, -1 for failure.
 These routines set
 .IR errstr .
 .SH BUGS
--- a/sys/src/9/port/chan.c
+++ b/sys/src/9/port/chan.c
@@ -745,13 +745,12 @@
 		}
 		m->mount = nm;
 	}
-	order = nm->mountid;
 	wunlock(&m->lock);
 	wunlock(&pg->ns);
 
 	mountfree(um);
 
-	return order;
+	return 0;
 }
 
 void