Mail Archives: djgpp-workers/1998/01/07/18:10:05
I think if the FSEXT doesn't dup the descriptor, we should just fail.
I can't imagine that doing it ourselves would ever be the right thing
to do.
> setmode(newfd, __file_handle_modes[fd]);
> +
> + /* if the fd refers to a file extension, and it didn't handle the dup2()
> + command (eg, it is an older fsext), we can do this ourselves: just set
> + the handle for newfd to be the same as the handler for fd, and copy the
> + data part (this is a bug potential if the fsext is using a dynamically
> + alloced resource for the data and it does not manage this on its own)
> + */
> + if (func) close(newfd);
> + {
> + void* data = __FSEXT_get_data(fd);
> + __FSEXT_set_function(newfd, func);
> + __FSEXT_set_data(newfd, data);
> + }
> +
> return newfd;
> }
>
- Raw text -