Changeset be79a663 in mainline for uspace/lib/posix/stdio.c
- Timestamp:
- 2011-08-19T17:37:54Z (14 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- ac7c7e36
- Parents:
- d7427a7e (diff), f00af83 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)
links above to see all the changes relative to each parent. - File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/posix/stdio.c
rd7427a7e rbe79a663 257 257 assert(stream != NULL); 258 258 259 /* Retrieve the node. */260 struct stat st;261 int rc;262 263 259 if (filename == NULL) { 264 rc = fstat(stream->fd, &st); 265 } else { 266 rc = stat(filename, &st); 267 if (-rc == ENOENT) { 268 /* file does not exist, create new file */ 269 FILE* tmp = fopen(filename, mode); 270 if (tmp != NULL) { 271 fclose(tmp); 272 /* try again */ 273 rc = stat(filename, &st); 274 } 275 } 276 } 277 278 if (rc != EOK) { 279 fclose(stream); 280 errno = -rc; 281 return NULL; 282 } 283 284 fdi_node_t node = { 285 .fs_handle = st.fs_handle, 286 .service_id = st.service_id, 287 .index = st.index 288 }; 260 /* POSIX allows this to be imlementation-defined. HelenOS currently 261 * does not support changing the mode. */ 262 // FIXME: handle mode change once it is supported 263 return stream; 264 } 289 265 290 266 /* Open a new stream. */ 291 FILE* new = fopen _node(&node, mode);267 FILE* new = fopen(filename, mode); 292 268 if (new == NULL) { 293 269 fclose(stream); 294 /* fopen_node() sets errno.*/270 /* errno was set by fopen() */ 295 271 return NULL; 296 272 }
Note:
See TracChangeset
for help on using the changeset viewer.