Changeset ec18957a in mainline for uspace/lib/posix/unistd.c
- Timestamp:
- 2011-07-08T00:54:24Z (14 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 9c1984f
- Parents:
- 3f466c33
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/posix/unistd.c
r3f466c33 rec18957a 38 38 #include "internal/common.h" 39 39 #include "unistd.h" 40 #include <task.h> 41 #include <errno.h>40 41 #include "errno.h" 42 42 #include "string.h" 43 43 #include "fcntl.h" 44 #include <stats.h> 44 45 #include "libc/task.h" 46 #include "libc/stats.h" 45 47 #include "libc/malloc.h" 46 48 … … 145 147 /* Check file existence by attempt to open it. */ 146 148 int fd = open(path, O_RDONLY); 147 // TODO: propagate a POSIX compatible errno 148 int rc = fd < 0 ? -1 : 0; 149 close(fd); 150 return rc; 149 if (fd < 0) { 150 /* FIXME: open() returns error code as negative retval. */ 151 errno = -fd; 152 fd = -1; 153 } else { 154 close(fd); 155 } 156 return fd; 151 157 } else if (amode & (X_OK | W_OK | R_OK)) { 152 158 /* HelenOS doesn't support permissions, return success. */
Note:
See TracChangeset
for help on using the changeset viewer.