Changes in uspace/lib/posix/stdio.c [f00af83:4c8f5e7] in mainline
- File:
-
- 1 edited
-
uspace/lib/posix/stdio.c (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/posix/stdio.c
rf00af83 r4c8f5e7 257 257 assert(stream != NULL); 258 258 259 /* Retrieve the node. */ 260 struct stat st; 261 int rc; 262 259 263 if (filename == NULL) { 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 } 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 }; 265 289 266 290 /* Open a new stream. */ 267 FILE* new = fopen (filename, mode);291 FILE* new = fopen_node(&node, mode); 268 292 if (new == NULL) { 269 293 fclose(stream); 270 /* errno was set by fopen()*/294 /* fopen_node() sets errno. */ 271 295 return NULL; 272 296 }
Note:
See TracChangeset
for help on using the changeset viewer.
