Changes in uspace/lib/posix/source/unistd.c [f77c1c9:1165a419] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/posix/source/unistd.c
rf77c1c9 r1165a419 213 213 ssize_t posix_read(int fildes, void *buf, size_t nbyte) 214 214 { 215 size_t nread; 216 int rc; 217 218 rc = rcerrno(vfs_read, fildes, &posix_pos[fildes], buf, nbyte, &nread); 219 if (rc != EOK) 220 return -1; 221 return (ssize_t) nread; 215 ssize_t size = rcerrno(vfs_read, fildes, &posix_pos[fildes], buf, nbyte); 216 if (size < 0) 217 return -1; 218 return size; 222 219 } 223 220 … … 232 229 ssize_t posix_write(int fildes, const void *buf, size_t nbyte) 233 230 { 234 size_t nwr; 235 int rc; 236 237 rc = rcerrno(vfs_write, fildes, &posix_pos[fildes], buf, nbyte, &nwr); 238 if (rc != EOK) 239 return -1; 240 return nwr; 231 ssize_t size = rcerrno(vfs_write, fildes, &posix_pos[fildes], buf, nbyte); 232 if (size < 0) 233 return -1; 234 return size; 241 235 } 242 236 … … 355 349 int posix_dup2(int fildes, int fildes2) 356 350 { 357 int file; 358 int rc = vfs_clone(fildes, fildes2, false, &file); 359 if (rc != EOK) { 360 errno = rc < 0 ? -rc : rc; 361 return -1; 362 } 363 return file; 351 return negerrno(vfs_clone, fildes, fildes2, false); 364 352 } 365 353
Note:
See TracChangeset
for help on using the changeset viewer.