jehanne: fix open_translator

This commit is contained in:
2017-04-28 22:58:52 +02:00
parent 6ba8da3d11
commit 00a07a6ca2

View File

@ -114,22 +114,30 @@ open_translator(int flag, int mode, long *omode, long *cperm)
{ {
*omode = 0; *omode = 0;
*cperm = 0; *cperm = 0;
if(flag & O_EXEC)
*omode |= OEXEC; switch(flag & O_ACCMODE){
else if(flag & O_RDONLY) case O_RDONLY:
*omode |= OREAD; *omode |= OREAD;
else if(flag & O_RDWR) break;
*omode |= ORDWR; case O_WRONLY:
else if(flag & O_WRONLY)
*omode |= OWRITE; *omode |= OWRITE;
break;
case O_RDWR:
*omode |= ORDWR;
break;
}
if(flag & O_EXEC)
*omode = OEXEC;
else if(flag & O_SEARCH) else if(flag & O_SEARCH)
*omode |= OREAD; *omode |= OREAD;
if(flag & O_CREAT) if(flag & O_CREAT){
if(flag & O_EXCL) if(flag & O_EXCL)
*cperm = ~mode; *cperm = ~mode;
else else
*cperm = mode; *cperm = mode;
}
if(flag & O_TRUNC) if(flag & O_TRUNC)
*omode |= OTRUNC; *omode |= OTRUNC;