https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110574

--- Comment #6 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Jonathan Wakely <r...@gcc.gnu.org>:

https://gcc.gnu.org/g:2f6bbc9a7d9a62423c576e13dc46323fe16ba5aa

commit r14-2476-g2f6bbc9a7d9a62423c576e13dc46323fe16ba5aa
Author: Jonathan Wakely <jwak...@redhat.com>
Date:   Thu Jul 6 17:10:41 2023 +0100

    libstdc++: Fix --enable-cstdio=stdio_pure [PR110574]

    When configured with --enable-cstdio=stdio_pure we need to consistently
    use fseek and not mix seeks on the file descriptor with reads and writes
    on the FILE stream.

    There are also a number of bugs related to error handling and return
    values, because fread and fwrite return 0 on error, not -1, and fseek
    returns 0 on success, not the file offset.

    libstdc++-v3/ChangeLog:

            PR libstdc++/110574
            * acinclude.m4 (GLIBCXX_CHECK_LFS): Check for fseeko and ftello
            and define _GLIBCXX_USE_FSEEKO_FTELLO.
            * config.h.in: Regenerate.
            * configure: Regenerate.
            * config/io/basic_file_stdio.cc (xwrite) [_GLIBCXX_USE_STDIO_PURE]:
            Check for fwrite error correctly.
            (__basic_file<char>::xsgetn) [_GLIBCXX_USE_STDIO_PURE]: Check for
            fread error correctly.
            (get_file_offset): New function.
            (__basic_file<char>::seekoff) [_GLIBCXX_USE_STDIO_PURE]: Use
            fseeko if available. Use get_file_offset instead of return value
            of fseek.
            (__basic_file<char>::showmanyc): Use get_file_offset.

Reply via email to