Changeset f77c1c9 in mainline for uspace/lib/c/generic/io/io.c
- Timestamp:
- 2017-12-08T21:03:35Z (8 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- c19a5a59
- Parents:
- c1694b6b
- git-author:
- Jiří Zárevúcky <zarevucky.jiri@…> (2017-12-07 19:44:55)
- git-committer:
- Jiří Zárevúcky <zarevucky.jiri@…> (2017-12-08 21:03:35)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/c/generic/io/io.c
rc1694b6b rf77c1c9 108 108 * This will probably be removed later. 109 109 */ 110 111 110 int infd = inbox_get("stdin"); 112 111 if (infd >= 0) { 113 int stdinfd = vfs_clone(infd, -1, false); 112 int stdinfd = -1; 113 (void) vfs_clone(infd, -1, false, &stdinfd); 114 114 assert(stdinfd == 0); 115 115 vfs_open(stdinfd, MODE_READ); … … 122 122 int outfd = inbox_get("stdout"); 123 123 if (outfd >= 0) { 124 int stdoutfd = vfs_clone(outfd, -1, false); 124 int stdoutfd = -1; 125 (void) vfs_clone(outfd, -1, false, &stdoutfd); 125 126 assert(stdoutfd <= 1); 126 127 while (stdoutfd < 1) 127 stdoutfd = vfs_clone(outfd, -1, false);128 (void) vfs_clone(outfd, -1, false, &stdoutfd); 128 129 vfs_open(stdoutfd, MODE_APPEND); 129 130 stdout = fdopen(stdoutfd, "a"); … … 135 136 int errfd = inbox_get("stderr"); 136 137 if (errfd >= 0) { 137 int stderrfd = vfs_clone(errfd, -1, false); 138 int stderrfd = -1; 139 (void) vfs_clone(errfd, -1, false, &stderrfd); 138 140 assert(stderrfd <= 2); 139 141 while (stderrfd < 2) 140 stderrfd = vfs_clone(errfd, -1, false);142 (void) vfs_clone(errfd, -1, false, &stderrfd); 141 143 vfs_open(stderrfd, MODE_APPEND); 142 144 stderr = fdopen(stderrfd, "a"); … … 294 296 if (create) 295 297 flags |= WALK_MAY_CREATE; 296 int file = vfs_lookup(path, flags); 297 if (file < 0) { 298 errno = file; 298 int file; 299 int rc = vfs_lookup(path, flags, &file); 300 if (rc != EOK) { 301 errno = rc; 299 302 free(stream); 300 303 return NULL; 301 304 } 302 305 303 intrc = vfs_open(file, mode);306 rc = vfs_open(file, mode); 304 307 if (rc != EOK) { 305 308 errno = rc; … … 373 376 list_remove(&stream->link); 374 377 375 if (rc != 0) {376 /* errno was set by close() */378 if (rc != EOK) { 379 errno = rc; 377 380 return EOF; 378 381 }
Note:
See TracChangeset
for help on using the changeset viewer.