This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH] Add fseek to ui-file
On Tue, Dec 11, 2012 at 10:39 PM, Pedro Alves <palves@redhat.com> wrote:
> On 12/11/2012 02:34 PM, Hui Zhu wrote:
>
>> What about add a flag to struct stdio_file to record the error in this fd.
>> When stdio_file_xxx get error, set it and throw error.
>> Each stdio_file_xxx function check this flag before do syscall. If
>> this fd get error, just return.
>
> That would allow the second caller to proceed as if no error
> had happened. That's not a good interface.
>
> --
> Pedro Alves
>
What about change it to if flag is set, not do anything like current
what we do. If not, throw error.
For example:
if (write (stdio->fd, buf, length_buf) < 0)
{
if (!stdio->error_throwed)
{
stdio->error_throwed = 1;
error(xxx);
}
}
No infinite recursion.
Thanks,
Hui