diff options
Diffstat (limited to 'src/lib9/open.c')
| -rw-r--r-- | src/lib9/open.c | 27 |
1 files changed, 4 insertions, 23 deletions
diff --git a/src/lib9/open.c b/src/lib9/open.c index 1fa3c1bc7..4ac81ba5f 100644 --- a/src/lib9/open.c +++ b/src/lib9/open.c @@ -35,16 +35,13 @@ THE SOFTWARE. int p9open(char *name, int mode) { - int cexec, rclose; - int fd, umode, lock, rdwr; - struct flock fl; + int rclose; + int fd, umode, rdwr; rdwr = mode&3; umode = rdwr; - cexec = mode&OCEXEC; rclose = mode&ORCLOSE; - lock = mode&OLOCK; - mode &= ~(3|OCEXEC|ORCLOSE|OLOCK); + mode &= ~(3|ORCLOSE); if(mode&OTRUNC){ umode |= O_TRUNC; mode ^= OTRUNC; @@ -53,10 +50,6 @@ p9open(char *name, int mode) umode |= O_DIRECT; mode ^= ODIRECT; } - if(mode&ONONBLOCK){ - umode |= O_NONBLOCK; - mode ^= ONONBLOCK; - } if(mode&OAPPEND){ umode |= O_APPEND; mode ^= OAPPEND; @@ -65,21 +58,9 @@ p9open(char *name, int mode) werrstr("mode 0x%x not supported", mode); return -1; } + umode |= O_BINARY; fd = open(name, umode); if(fd >= 0){ - if(lock){ - fl.l_type = (rdwr==OREAD) ? F_RDLCK : F_WRLCK; - fl.l_whence = SEEK_SET; - fl.l_start = 0; - fl.l_len = 0; - if(fcntl(fd, F_SETLK, &fl) < 0){ - close(fd); - werrstr("lock: %r"); - return -1; - } - } - if(cexec) - fcntl(fd, F_SETFL, FD_CLOEXEC); if(rclose) remove(name); } |
