ref: 1b70ab59794ffa67e4294129943819685ae5542f
parent: 709e78b9f9a76658cc6c704176ebf8f5821ee9d2
author: cinap_lenrek <cinap_lenrek@felloff.net>
date: Fri Aug 1 12:57:39 EDT 2014
exportfs: use argv0 instead of hardcoding "/bin/exportfs" in openmount(), dont use 0 for nil
--- a/sys/src/cmd/exportfs/exportsrv.c
+++ b/sys/src/cmd/exportfs/exportsrv.c
@@ -62,7 +62,7 @@
Fsrpc *w;
Proc *m;
- for(m = Proclist; m; m = m->next){
+ for(m = Proclist; m != nil; m = m->next){
w = m->busy;
if(w == nil || w->work.tag != t->work.oldtag)
continue;
@@ -94,7 +94,7 @@
char buf[128];
f = newfid(t->work.fid);
- if(f == 0) {
+ if(f == nil) {
reply(&t->work, &rhdr, Ebadfid);
putsbuf(t);
return;
@@ -101,7 +101,7 @@
}
if(srvfd >= 0){
- if(psmpt == 0){
+ if(psmpt == nil){
Nomount:
reply(&t->work, &rhdr, Enopsmt);
freefid(t->work.fid);
@@ -145,15 +145,15 @@
Fid *n;
n = newfid(new);
- if(n == 0) {
+ if(n == nil) {
n = getfid(new);
- if(n == 0)
+ if(n == nil)
fatal("inconsistent fids");
if(n->fid >= 0)
close(n->fid);
freefid(new);
n = newfid(new);
- if(n == 0)
+ if(n == nil)
fatal("inconsistent fids2");
}
n->f = f->f;
@@ -171,7 +171,7 @@
int i;
f = getfid(t->work.fid);
- if(f == 0) {
+ if(f == nil) {
reply(&t->work, &rhdr, Ebadfid);
putsbuf(t);
return;
@@ -202,7 +202,7 @@
}
wf = file(f->f, t->work.wname[i]);
- if(wf == 0){
+ if(wf == nil){
errstr(err, sizeof err);
e = err;
break;
@@ -229,7 +229,7 @@
Fid *f;
f = getfid(t->work.fid);
- if(f == 0) {
+ if(f == nil) {
reply(&t->work, &rhdr, Ebadfid);
putsbuf(t);
return;
@@ -254,7 +254,7 @@
uchar *statbuf;
f = getfid(t->work.fid);
- if(f == 0) {
+ if(f == nil) {
reply(&t->work, &rhdr, Ebadfid);
putsbuf(t);
return;
@@ -311,7 +311,7 @@
return;
}
f = getfid(t->work.fid);
- if(f == 0) {
+ if(f == nil) {
reply(&t->work, &rhdr, Ebadfid);
putsbuf(t);
return;
@@ -329,7 +329,7 @@
}
nf = file(f->f, t->work.name);
- if(nf == 0) {
+ if(nf == nil) {
errstr(err, sizeof err);
reply(&t->work, &rhdr, err);
putsbuf(t);
@@ -358,7 +358,7 @@
return;
}
f = getfid(t->work.fid);
- if(f == 0) {
+ if(f == nil) {
reply(&t->work, &rhdr, Ebadfid);
putsbuf(t);
return;
@@ -400,7 +400,7 @@
return;
}
f = getfid(t->work.fid);
- if(f == 0) {
+ if(f == nil) {
reply(&t->work, &rhdr, Ebadfid);
putsbuf(t);
return;
@@ -631,7 +631,7 @@
}
free(dir);
- arg[0] = "exportfs";
+ arg[0] = argv0; /* "/bin/exportfs" */
snprint(fdbuf, sizeof fdbuf, "-S/fd/%d", sfd);
arg[1] = fdbuf;
snprint(mbuf, sizeof mbuf, "-m%lud", messagesize-IOHDRSZ);
@@ -638,7 +638,7 @@
arg[2] = mbuf;
arg[3] = nil;
- exec("/bin/exportfs", arg);
+ exec(arg[0], arg);
_exits("whoops: exec failed");
return -1;
}
@@ -654,7 +654,7 @@
work = &p->work;
f = getfid(work->fid);
- if(f == 0) {
+ if(f == nil) {
reply(work, &rhdr, Ebadfid);
return;
}
@@ -700,7 +700,7 @@
work = &p->work;
f = getfid(work->fid);
- if(f == 0) {
+ if(f == nil) {
reply(work, &rhdr, Ebadfid);
return;
}
@@ -707,7 +707,7 @@
n = (work->count > messagesize-IOHDRSZ) ? messagesize-IOHDRSZ : work->count;
data = malloc(n);
- if(data == 0) {
+ if(data == nil) {
reply(work, &rhdr, Enomem);
return;
}
@@ -742,7 +742,7 @@
work = &p->work;
f = getfid(work->fid);
- if(f == 0) {
+ if(f == nil) {
reply(work, &rhdr, Ebadfid);
return;
}