shithub: riscv

Download patch

ref: ac88ce4f7f19be1aae1fdf390fa870b4be8dc3f5
parent: 7ff6ea0f70307d4b82e6df69eb1310a6e27aa4ad
author: cinap_lenrek <cinap_lenrek@felloff.net>
date: Sat May 2 13:32:01 EDT 2020

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.

--- a/sys/src/cmd/5e/5e.c
+++ b/sys/src/cmd/5e/5e.c
@@ -23,9 +23,9 @@
 static void
 adjustns(void)
 {
-	if(bind("/arm/bin", "/bin", MREPL) < 0)
+	if(bind("/arm/bin", "/bin", MREPL) == -1)
 		sysfatal("bind: %r");
-	if(bind("/rc/bin", "/bin", MAFTER) < 0)
+	if(bind("/rc/bin", "/bin", MAFTER) == -1)
 		sysfatal("bind: %r");
 	putenv("cputype", "arm");
 	putenv("objtype", "arm");
--- a/sys/src/cmd/acme/fsys.c
+++ b/sys/src/cmd/acme/fsys.c
@@ -268,13 +268,12 @@
 	close(sfd);
 	m = fsysaddid(dir, ndir, incl, nincl);
 	sprint(buf, "%d", m->id);
-	if(mount(cfd, -1, "/mnt/acme", MREPL, buf) < 0){
+	if(mount(cfd, -1, "/mnt/acme", MREPL, buf) == -1){
 		fsysdelid(m);
 		return nil;
 	}
-	close(cfd);
 	bind("/mnt/acme", "/mnt/wsys", MREPL);
-	if(bind("/mnt/acme", "/dev", MBEFORE) < 0){
+	if(bind("/mnt/acme", "/dev", MBEFORE) == -1){
 		fsysdelid(m);
 		return nil;
 	}
--- a/sys/src/cmd/auth/factotum/util.c
+++ b/sys/src/cmd/auth/factotum/util.c
@@ -14,7 +14,7 @@
 
 	if(access("/net/cs", AEXIST) < 0){
 		if((srvfd = open("#s/cs", ORDWR)) >= 0){
-			if(mount(srvfd, -1, "/net", MBEFORE, "") >= 0)
+			if(mount(srvfd, -1, "/net", MBEFORE, "") != -1)
 				return 0;
 			close(srvfd);
 		}
--- a/sys/src/cmd/auth/keyfs.c
+++ b/sys/src/cmd/auth/keyfs.c
@@ -212,7 +212,7 @@
 		error("fork");
 	default:
 		close(p[1]);
-		if(mount(p[0], -1, mntpt, MREPL|MCREATE, "") < 0)
+		if(mount(p[0], -1, mntpt, MREPL|MCREATE, "") == -1)
 			error("can't mount: %r");
 		exits(0);
 	}
--- a/sys/src/cmd/aux/depend.c
+++ b/sys/src/cmd/aux/depend.c
@@ -300,7 +300,7 @@
 	close(pfd[1]);
 
 	time(nil);	/* open fd for time before losing / */
-	if(bind(argv[1], "/", MREPL) == 0)
+	if(bind(argv[1], "/", MREPL) == -1)
 		fatal("can't bind %s to /", argv[1]);
 
 	fs = emalloc(sizeof(Fs));
--- a/sys/src/cmd/aux/searchfs.c
+++ b/sys/src/cmd/aux/searchfs.c
@@ -216,7 +216,7 @@
 		exits(nil);
 	}
 
-	if(mount(p[1], -1, mnt, MREPL, "") < 0){
+	if(mount(p[1], -1, mnt, MREPL, "") == -1){
 		close(p[1]);
 		fatal("mount failed");
 	}
--- a/sys/src/cmd/aux/timesync.c
+++ b/sys/src/cmd/aux/timesync.c
@@ -303,7 +303,7 @@
 		fd = open(timeserver, ORDWR);
 		if(fd < 0)
 			sysfatal("opening %s: %r", timeserver);
-		if(amount(fd, "/n/boot", MREPL, "") < 0)
+		if(amount(fd, "/n/boot", MREPL, "") == -1)
 			sysfatal("mounting %s: %r", timeserver);
 		close(fd);
 		break;
--- a/sys/src/cmd/bind.c
+++ b/sys/src/cmd/bind.c
@@ -29,7 +29,7 @@
 	if(argc != 2 || (flag&MAFTER)&&(flag&MBEFORE))
 		usage();
 
-	if(bind(argv[0], argv[1], flag) < 0){
+	if(bind(argv[0], argv[1], flag) == -1){
 		if(qflag)
 			exits(0);
 		/* try to give a less confusing error than the default */
--- a/sys/src/cmd/bzfs/oramfs.c
+++ b/sys/src/cmd/bzfs/oramfs.c
@@ -208,7 +208,7 @@
 		break;
 	default:
 		close(mfd[0]);	/* don't deadlock if child fails */
-		if(defmnt && mount(srvfd, -1, defmnt, MREPL|MCREATE, "") < 0)
+		if(defmnt && mount(srvfd, -1, defmnt, MREPL|MCREATE, "") == -1)
 			error("mount failed: %r");
 	}
 }
--- a/sys/src/cmd/cfs/cfs.c
+++ b/sys/src/cmd/cfs/cfs.c
@@ -264,7 +264,7 @@
 			err = mount(p[1], -1, mountpoint, MREPL|MCREATE, "");
 		else
 			err = amount(p[1], mountpoint, MREPL|MCREATE, "");
-		if (err < 0)
+		if (err == -1)
 			error("mount failed: %r");
 		exits(0);
 	case -1:
--- a/sys/src/cmd/cpu.c
+++ b/sys/src/cmd/cpu.c
@@ -331,7 +331,7 @@
 	strcpy(buf, VERSION9P);
 	if(fversion(fd, 64*1024, buf, sizeof buf) < 0)
 		exits("fversion failed");
-	if(mount(fd, -1, "/mnt/term", MCREATE|MREPL, "") < 0)
+	if(mount(fd, -1, "/mnt/term", MCREATE|MREPL, "") == -1)
 		exits("mount failed");
 
 	close(fd);
@@ -1180,7 +1180,7 @@
 		return;
 	case 0:
 		close(pfd[0]);
-		if(mount(pfd[1], -1, "/dev", MBEFORE, "") < 0)
+		if(mount(pfd[1], -1, "/dev", MBEFORE, "") == -1)
 			fprint(2, "cpu: can't mount note proc: %r\n");
 		close(pfd[1]);
 		return;
--- a/sys/src/cmd/disk/sacfs/sacfs.c
+++ b/sys/src/cmd/disk/sacfs/sacfs.c
@@ -204,7 +204,7 @@
 		break;
 	default:
 		close(p[0]);	/* don't deadlock if child fails */
-		if(defmnt && mount(p[1], defmnt, MREPL|MCREATE, "") < 0)
+		if(defmnt && mount(p[1], defmnt, MREPL|MCREATE, "") == -1)
 			error("mount failed");
 	}
 	exits(0);
--- a/sys/src/cmd/exportfs/exportsrv.c
+++ b/sys/src/cmd/exportfs/exportsrv.c
@@ -119,7 +119,7 @@
 			goto Nomount;
 		sprint(buf, "/mnt/exportfs/%d", i);
 		nfd = dup(srvfd, -1);
-		if(amount(nfd, buf, MREPL|MCREATE, t->work.aname) < 0){
+		if(amount(nfd, buf, MREPL|MCREATE, t->work.aname) == -1){
 			errstr(buf, sizeof buf);
 			reply(&t->work, &rhdr, buf);
 			freefid(t->work.fid);
--- a/sys/src/cmd/import.c
+++ b/sys/src/cmd/import.c
@@ -206,7 +206,7 @@
 		post(srvfile, srvpost, fd);
 	}
 	procsetname("mount on %s", mntpt);
-	if(mount(fd, -1, mntpt, mntflags, "") < 0)
+	if(mount(fd, -1, mntpt, mntflags, "") == -1)
 		sysfatal("can't mount %s: %r", argv[1]);
 	alarm(0);
 
--- a/sys/src/cmd/iostats.c
+++ b/sys/src/cmd/iostats.c
@@ -313,7 +313,7 @@
 
 		rfork(RFENVG|RFNAMEG);
 
-		if(mount(pfd[0], -1, "/", mflag, "") < 0)
+		if(mount(pfd[0], -1, "/", mflag, "") == -1)
 			sysfatal("mount /: %r");
 
 		/* replace std fds with the exported ones */
--- a/sys/src/cmd/ip/ftpd.c
+++ b/sys/src/cmd/ip/ftpd.c
@@ -412,10 +412,10 @@
 		if(isnone){
 			fd = open("#s/boot", ORDWR);
 			if(fd < 0
-			|| bind("#/", "/", MAFTER) < 0
-			|| amount(fd, "/bin", MREPL, "") < 0
-			|| bind("#c", "/dev", MAFTER) < 0
-			|| bind(bindir, "/bin", MREPL) < 0)
+			|| bind("#/", "/", MAFTER) == -1
+			|| amount(fd, "/bin", MREPL, "") == -1
+			|| bind("#c", "/dev", MAFTER) == -1
+			|| bind(bindir, "/bin", MREPL) == -1)
 				exits("building name space");
 			close(fd);
 		}
@@ -810,12 +810,12 @@
 
 	rv = 0;
 
-	if(bind("#/", "/", MAFTER) < 0){
+	if(bind("#/", "/", MAFTER) == -1){
 		logit("can't bind #/ to /: %r");
 		return reply("500 can't bind #/ to /: %r");
 	}
 
-	if(bind(nci->spec, "/net", MBEFORE) < 0){
+	if(bind(nci->spec, "/net", MBEFORE) == -1){
 		logit("can't bind %s to /net: %r", nci->spec);
 		rv = reply("500 can't bind %s to /net: %r", nci->spec);
 		unmount("#/", "/");
--- a/sys/src/cmd/ip/ftpfs/ftpfs.c
+++ b/sys/src/cmd/ip/ftpfs/ftpfs.c
@@ -190,7 +190,7 @@
 		break;
 	default:
 		close(p[0]);
-		if(mount(p[1], -1, mountpoint, MREPL|MCREATE, "") < 0)
+		if(mount(p[1], -1, mountpoint, MREPL|MCREATE, "") == -1)
 			fatal("mount failed: %r");
 	}
 	exits(0);
--- a/sys/src/cmd/ip/httpd/netlib_find.c
+++ b/sys/src/cmd/ip/httpd/netlib_find.c
@@ -165,7 +165,7 @@
 	fd800fs = open(name, ORDWR);
 	if(fd800fs < 0)
 		exits("can't connect to 800fs server");
-	if(mount(fd800fs, -1, "/mnt", MREPL, "") < 0)
+	if(mount(fd800fs, -1, "/mnt", MREPL, "") == -1)
 		exits("can't mount /mnt");
 	fd800fs = open("/mnt/search", ORDWR);
 	n = strlen("search=")+strlen(pat)+1;
--- a/sys/src/cmd/ip/httpd/wikipost.c
+++ b/sys/src/cmd/ip/httpd/wikipost.c
@@ -139,7 +139,7 @@
 		hfail(c, HNotFound);
 		exits("failed");
 	}
-	if(mount(fd, -1, "/mnt/wiki", MREPL, "") < 0){
+	if(mount(fd, -1, "/mnt/wiki", MREPL, "") == -1){
 		syslog(0, LOG, "%s mount /mnt/wiki failed: %r", hp->remotesys);
 		hfail(c, HNotFound);
 		exits("failed");
--- a/sys/src/cmd/ip/telnetd.c
+++ b/sys/src/cmd/ip/telnetd.c
@@ -576,14 +576,14 @@
 	char *field[10];
 
 	/* a pipe to simulate the /dev/cons */
-	if(bind("#|", "/mnt/cons", MREPL) < 0)
+	if(bind("#|", "/mnt/cons", MREPL) == -1)
 		fatal("/dev/cons1", 0, 0);
-	if(bind("/mnt/cons/data1", "/dev/cons", MREPL) < 0)
+	if(bind("/mnt/cons/data1", "/dev/cons", MREPL) == -1)
 		fatal("/dev/cons2", 0, 0);
 
 	/* a pipe to simulate consctl */
-	if(bind("#|", "/mnt/consctl", MBEFORE) < 0
-	|| bind("/mnt/consctl/data1", "/dev/consctl", MREPL) < 0)
+	if(bind("#|", "/mnt/consctl", MBEFORE) == -1
+	|| bind("/mnt/consctl/data1", "/dev/consctl", MREPL) == -1)
 		fatal("/dev/consctl", 0, 0);
 
 	/* a process to read /dev/consctl and set the state in cons */
--- a/sys/src/cmd/lnfs.c
+++ b/sys/src/cmd/lnfs.c
@@ -162,7 +162,7 @@
 		break;
 	default:
 		close(p[0]);	/* don't deadlock if child fails */
-		if(mount(p[1], -1, defmnt, MREPL|MCREATE, "") < 0)
+		if(mount(p[1], -1, defmnt, MREPL|MCREATE, "") == -1)
 			sysfatal("mount failed: %r");
 	}
 	exits(0);
--- a/sys/src/cmd/mount.c
+++ b/sys/src/cmd/mount.c
@@ -97,7 +97,7 @@
 		rv = mount(fd, -1, argv[1], flag, spec);
 	else
 		rv = amount0(fd, argv[1], flag, spec, keyspec);
-	if(rv < 0){
+	if(rv == -1){
 		if(qflag)
 			exits(0);
 		fprint(2, "%s: mount %s: %r\n", argv0, argv[1]);
--- a/sys/src/cmd/ndb/cs.c
+++ b/sys/src/cmd/ndb/cs.c
@@ -310,7 +310,7 @@
 		 *  put ourselves into the file system
 		 */
 		close(p[0]);
-		if(mount(p[1], -1, mntpt, MAFTER, "") < 0)
+		if(mount(p[1], -1, mntpt, MAFTER, "") == -1)
 			error("mount failed");
 		_exits(0);
 	}
@@ -1675,7 +1675,7 @@
 		qunlock(&mountlock);
 		return -1;	
 	}
-	if(mount(fd, -1, mntpt, MAFTER, "") < 0){
+	if(mount(fd, -1, mntpt, MAFTER, "") == -1){
 		close(fd);
 		goto err;
 	}
--- a/sys/src/cmd/ndb/dns.c
+++ b/sys/src/cmd/ndb/dns.c
@@ -266,7 +266,7 @@
 		/*
 		 *  put ourselves into the file system
 		 */
-		if(mount(p[1], -1, mntpt, MAFTER, "") < 0)
+		if(mount(p[1], -1, mntpt, MAFTER, "") == -1)
 			fprint(2, "dns mount failed: %r\n");
 		_exits(0);
 	}
--- a/sys/src/cmd/paqfs/paqfs.c
+++ b/sys/src/cmd/paqfs/paqfs.c
@@ -252,7 +252,7 @@
 		break;
 	default:
 		close(pfd[1]);	/* don't deadlock if child fails */
-		if(mnt && mount(pfd[0], -1, mntpoint, MREPL|MCREATE, "") < 0)
+		if(mnt && mount(pfd[0], -1, mntpoint, MREPL|MCREATE, "") == -1)
 			sysfatal("mount %s: %r", mntpoint);
 	}
 	exits(0);
--- a/sys/src/cmd/pipefile.c
+++ b/sys/src/cmd/pipefile.c
@@ -78,9 +78,9 @@
 			sysfatal("open %s: %r", file);
 	}
 
-	if(bind("#|", TEMP, MREPL) < 0)
+	if(bind("#|", TEMP, MREPL) == -1)
 		sysfatal("bind pipe %s: %r", TEMP);
-	if(bind(TEMP "/data", file, MREPL) < 0)
+	if(bind(TEMP "/data", file, MREPL) == -1)
 		sysfatal("bind %s %s: %r", TEMP "/data", file);
 
 	fd0 = open(TEMP "/data1", OREAD);
--- a/sys/src/cmd/plumb/fsys.c
+++ b/sys/src/cmd/plumb/fsys.c
@@ -216,7 +216,7 @@
 	procrfork(fsysproc, nil, Stack, RFFDG);
 
 	close(p[0]);
-	if(mount(p[1], -1, "/mnt/plumb", MREPL, "") < 0)
+	if(mount(p[1], -1, "/mnt/plumb", MREPL, "") == -1)
 		error("can't mount /mnt/plumb: %r");
 	close(p[1]);
 }
--- a/sys/src/cmd/ratfs/main.c
+++ b/sys/src/cmd/ratfs/main.c
@@ -103,7 +103,7 @@
 		break;
 	default:
 		close(p[0]);
-		if(mount(p[1], -1, mountpoint, MREPL|MCREATE, "") < 0)
+		if(mount(p[1], -1, mountpoint, MREPL|MCREATE, "") == -1)
 			fatal("mount failed: %r");
 	}
 	exits(0);
@@ -155,10 +155,9 @@
 		 * another server is already running, so just exit.
 		 */
 		f = open(SRVFILE, ORDWR);
-		if(f >= 0 && mount(f, -1, mountpoint, MREPL|MCREATE, "") >= 0){
-				unmount(0, mountpoint);
-				close(f);
-				exits(0);
+		if(f >= 0 && mount(f, -1, mountpoint, MREPL|MCREATE, "") != -1){
+			unmount(0, mountpoint);
+			exits(0);
 		}
 		remove(SRVFILE);
 	}
--- a/sys/src/cmd/rio/fsys.c
+++ b/sys/src/cmd/rio/fsys.c
@@ -105,7 +105,7 @@
 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 @@
 
 	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;
 	}
--- a/sys/src/cmd/scat/header.c
+++ b/sys/src/cmd/scat/header.c
@@ -274,7 +274,7 @@
 	/*
 	 * mount nfs jukebox server
 	 */
-	if(mount(s1, -1, "/n/njuke", 0, "") < 0) {
+	if(mount(s1, -1, "/n/njuke", 0, "") == -1) {
 		close(s1);
 		Bprint(&bout, "\"mount /srv/%s /n/juke\" failed: %r\n", JUKEFS);
 		goto out;
@@ -300,7 +300,7 @@
 	/*
 	 * mount 9660 server
 	 */
-	if(mount(s2, -1, "/n/dss", 0, dssname) < 0) {
+	if(mount(s2, -1, "/n/dss", 0, dssname) == -1) {
 		close(s2);
 		if(count == 0) {
 			// do it again so /n/njuke is in 9660's namespace
--- a/sys/src/cmd/srv.c
+++ b/sys/src/cmd/srv.c
@@ -210,8 +210,8 @@
 		try = 0;
 	}
 
-	if((!doauth && mount(fd, -1, mtpt, mountflag, "") < 0)
-	|| (doauth && amount(fd, mtpt, mountflag, "") < 0)){
+	if((!doauth && mount(fd, -1, mtpt, mountflag, "") == -1)
+	|| (doauth && amount(fd, mtpt, mountflag, "") == -1)){
 		err[0] = 0;
 		errstr(err, sizeof err);
 		if(strstr(err, "Hangup") || strstr(err, "hungup") || strstr(err, "timed out")){
--- a/sys/src/cmd/tapefs/fs.c
+++ b/sys/src/cmd/tapefs/fs.c
@@ -140,7 +140,7 @@
 		break;
 	default:
 		close(p[0]);	/* don't deadlock if child fails */
-		if(mount(p[1], -1, defmnt, MREPL|MCREATE, "") < 0)
+		if(mount(p[1], -1, defmnt, MREPL|MCREATE, "") == -1)
 			error("mount failed");
 	}
 	exits(0);
--- a/sys/src/cmd/telco/telco.c
+++ b/sys/src/cmd/telco/telco.c
@@ -381,7 +381,7 @@
 		if(write(fd, buf, strlen(buf)) < 0)
 			error("writing /srv/telco");
 		close(fd);
-		if(mount(p[1], -1, "/net", MBEFORE, "") < 0)
+		if(mount(p[1], -1, "/net", MBEFORE, "") == -1)
 			error("mount failed");
 		exits(0);
 	}
@@ -1400,11 +1400,10 @@
 			syslog(0, LOGFILE, "can't open telco: %r");
 			exits(0);
 		}
-		if(mount(fd, -1, "/net", MAFTER, "") < 0){
+		if(mount(fd, -1, "/net", MAFTER, "") == -1){
 			syslog(0, LOGFILE, "can't mount: %r");
 			exits(0);
 		}
-		close(fd);
 
 		/* open connection through the file system interface */
 		sprint(file, "/net/telco/%zd/data", d - dev);
--- a/sys/src/cmd/trace.c
+++ b/sys/src/cmd/trace.c
@@ -584,11 +584,11 @@
 		line[sizeof(line) - 1] = '\0';
 		rfork(RFNAMEG);
 	
-		if(mount(wfd, -1, "/mnt/wsys", MREPL, line) < 0) 
+		if(mount(wfd, -1, "/mnt/wsys", MREPL, line) == -1) 
 			sysfatal("%s: Cannot mount %s under /mnt/wsys: %r",
 						argv0, line);
 	
-		if(bind("/mnt/wsys", "/dev", MBEFORE) < 0) 
+		if(bind("/mnt/wsys", "/dev", MBEFORE) == -1) 
 			sysfatal("%s: Cannot bind /mnt/wsys in /dev: %r",
 						argv0);
 	
--- a/sys/src/cmd/upas/fs/fs.c
+++ b/sys/src/cmd/upas/fs/fs.c
@@ -359,7 +359,7 @@
 			snprint(srvfile, sizeof srvfile, "/srv/upasfs.%s", user);
 			post(srvfile, "upasfs", p[1]);
 		}else
-			if(mount(p[1], -1, mntpt, MREPL, "") < 0)
+			if(mount(p[1], -1, mntpt, MREPL, "") == -1)
 				error("mount failed");
 	}
 	exits("");
--- a/sys/src/cmd/upas/imap4d/auth.c
+++ b/sys/src/cmd/upas/imap4d/auth.c
@@ -29,11 +29,10 @@
 	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;
--- a/sys/src/cmd/vac/vacfs.c
+++ b/sys/src/cmd/vac/vacfs.c
@@ -216,7 +216,7 @@
 	if(!stdio){
 		close(p[0]);
 		if(defmnt){
-			if(mount(srvfd, -1, defmnt, MREPL|MCREATE, "") < 0)
+			if(mount(srvfd, -1, defmnt, MREPL|MCREATE, "") == -1)
 				sysfatal("mount %s: %r", defmnt);
 		}
 	}
--- a/sys/src/games/doom/i_sound.c
+++ b/sys/src/games/doom/i_sound.c
@@ -484,7 +484,7 @@
 			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)
--- a/sys/src/libauth/newns.c
+++ b/sys/src/libauth/newns.c
@@ -184,7 +184,7 @@
 	}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 @@
 			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);