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.
This commit is contained in:
parent
7ff6ea0f70
commit
ac88ce4f7f
39 changed files with 63 additions and 67 deletions
|
@ -23,9 +23,9 @@ dump(void)
|
|||
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");
|
||||
|
|
|
@ -268,13 +268,12 @@ fsysmount(Rune *dir, int ndir, Rune **incl, int nincl)
|
|||
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;
|
||||
}
|
||||
|
|
|
@ -14,7 +14,7 @@ bindnetcs(void)
|
|||
|
||||
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);
|
||||
}
|
||||
|
|
|
@ -212,7 +212,7 @@ main(int argc, char *argv[])
|
|||
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);
|
||||
}
|
||||
|
|
|
@ -300,7 +300,7 @@ realmain(void *a)
|
|||
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));
|
||||
|
|
|
@ -216,7 +216,7 @@ main(int argc, char **argv)
|
|||
exits(nil);
|
||||
}
|
||||
|
||||
if(mount(p[1], -1, mnt, MREPL, "") < 0){
|
||||
if(mount(p[1], -1, mnt, MREPL, "") == -1){
|
||||
close(p[1]);
|
||||
fatal("mount failed");
|
||||
}
|
||||
|
|
|
@ -303,7 +303,7 @@ main(int argc, char **argv)
|
|||
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;
|
||||
|
|
|
@ -29,7 +29,7 @@ main(int argc, char *argv[])
|
|||
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 */
|
||||
|
|
|
@ -208,7 +208,7 @@ ramfsmain(int argc, char *argv[])
|
|||
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");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -264,7 +264,7 @@ mountinit(char *server, char *mountpoint)
|
|||
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:
|
||||
|
|
|
@ -331,7 +331,7 @@ remoteside(void)
|
|||
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 @@ lclnoteproc(int netfd)
|
|||
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;
|
||||
|
|
|
@ -204,7 +204,7 @@ main(int argc, char *argv[])
|
|||
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);
|
||||
|
|
|
@ -119,7 +119,7 @@ Xattach(Fsrpc *t)
|
|||
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);
|
||||
|
|
|
@ -206,7 +206,7 @@ main(int argc, char **argv)
|
|||
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);
|
||||
|
||||
|
|
|
@ -313,7 +313,7 @@ main(int argc, char **argv)
|
|||
|
||||
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 */
|
||||
|
|
|
@ -412,10 +412,10 @@ transfer(char *cmd, char *a1, char *a2, char *a3, int image)
|
|||
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 @@ mountnet(void)
|
|||
|
||||
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("#/", "/");
|
||||
|
|
|
@ -190,7 +190,7 @@ main(int argc, char *argv[])
|
|||
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);
|
||||
|
|
|
@ -165,7 +165,7 @@ init800fs(char*name,char*pat)
|
|||
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;
|
||||
|
|
|
@ -139,7 +139,7 @@ mountwiki(HConnect *c, char *service)
|
|||
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");
|
||||
|
|
|
@ -576,14 +576,14 @@ conssim(void)
|
|||
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 */
|
||||
|
|
|
@ -162,7 +162,7 @@ main(int argc, char *argv[])
|
|||
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);
|
||||
|
|
|
@ -97,7 +97,7 @@ main(int argc, char *argv[])
|
|||
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]);
|
||||
|
|
|
@ -310,7 +310,7 @@ mountinit(char *service, char *mntpt)
|
|||
* 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 @@ err:
|
|||
qunlock(&mountlock);
|
||||
return -1;
|
||||
}
|
||||
if(mount(fd, -1, mntpt, MAFTER, "") < 0){
|
||||
if(mount(fd, -1, mntpt, MAFTER, "") == -1){
|
||||
close(fd);
|
||||
goto err;
|
||||
}
|
||||
|
|
|
@ -266,7 +266,7 @@ mountinit(char *service, char *mntpt)
|
|||
/*
|
||||
* 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);
|
||||
}
|
||||
|
|
|
@ -252,7 +252,7 @@ main(int argc, char *argv[])
|
|||
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);
|
||||
|
|
|
@ -78,9 +78,9 @@ main(int argc, char *argv[])
|
|||
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);
|
||||
|
|
|
@ -216,7 +216,7 @@ startfsys(void)
|
|||
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]);
|
||||
}
|
||||
|
|
|
@ -103,7 +103,7 @@ main(int argc, char *argv[])
|
|||
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 @@ post(int fd, char *mountpoint)
|
|||
* 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);
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -274,7 +274,7 @@ loop:
|
|||
/*
|
||||
* 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 @@ loop:
|
|||
/*
|
||||
* 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
|
||||
|
|
|
@ -210,8 +210,8 @@ Mount:
|
|||
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")){
|
||||
|
|
|
@ -140,7 +140,7 @@ main(int argc, char *argv[])
|
|||
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);
|
||||
|
|
|
@ -381,7 +381,7 @@ main(int argc, char *argv[])
|
|||
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 @@ receiver(Dev *d)
|
|||
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);
|
||||
|
|
|
@ -584,11 +584,11 @@ drawtrace(void)
|
|||
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);
|
||||
|
||||
|
|
|
@ -359,7 +359,7 @@ main(int argc, char *argv[])
|
|||
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("");
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -216,7 +216,7 @@ threadmain(int argc, char *argv[])
|
|||
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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -184,7 +184,7 @@ nsop(char *fn, int argc, char *argv[], AuthRpc *rpc)
|
|||
}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 @@ nsop(char *fn, int argc, char *argv[], AuthRpc *rpc)
|
|||
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);
|
||||
|
|
Loading…
Reference in a new issue