parent
edd84db070
commit
19bf511603
|
@ -64,16 +64,21 @@ static Chan*
|
||||||
dupcreate(Chan* c, char* name, unsigned long omode, unsigned long perm)
|
dupcreate(Chan* c, char* name, unsigned long omode, unsigned long perm)
|
||||||
{
|
{
|
||||||
FdPair in, out;
|
FdPair in, out;
|
||||||
int d;
|
|
||||||
|
|
||||||
if((omode|OCEXEC) == ~0 && c->qid.path == 0){
|
if((omode|OCEXEC) == ~0 && c->qid.path == 0){
|
||||||
in.aslong = perm;
|
in.aslong = perm;
|
||||||
out.aslong = ~0;
|
/* ensure that fd.aslong never get ~0 value */
|
||||||
d = sysdup(in.fd[0], in.fd[1]);
|
if(in.fd[1] == 0){
|
||||||
if(d >= 0){
|
/* the requested fd is zero: out.fd[0] will
|
||||||
out.fd[1] = d;
|
* prevent the whole fd.aslong to become -1
|
||||||
errorl(nil, ~out.aslong);
|
* if the operation succeed
|
||||||
|
*/
|
||||||
|
out.fd[0] = -1;
|
||||||
|
} else {
|
||||||
|
out.fd[0] = 0;
|
||||||
}
|
}
|
||||||
|
out.fd[1] = sysdup(in.fd[0], in.fd[1]);
|
||||||
|
errorl(nil, ~out.aslong);
|
||||||
}
|
}
|
||||||
error(Eperm);
|
error(Eperm);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue