util: remove usage of `strerror_s/r` #36038

pull fanquake wants to merge 1 commits into bitcoin:master from fanquake:drop_strerror_r changing 5 files +4 −41
  1. fanquake commented at 2:27 PM on August 20, 2026: member

    Use std::system_category().message(err), which internally dispatches to strerror_r/s, and should handle unknown errors.

    See: https://github.com/llvm/llvm-project/blob/4e9e83400a5702059c8a18e2fb6174038875e8a6/libcxx/src/system_error.cpp#L231-L237 for one standard library implementation.

  2. DrahtBot added the label Utils/log/libs on Aug 20, 2026
  3. DrahtBot commented at 2:27 PM on August 20, 2026: contributor

    <!--e57a25ab6845829454e8d69fc972939a-->

    The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.

    <!--006a51241073e994b41acfe9ec718e94-->

    External sites

    <!--021abf342d371248e50ceaed478a90ca-->

    Reviews

    See the guideline and AI policy for information on the review process. A summary of reviews will appear here.

    <!--5faf32d7da4f0f540f40219e4f7537a3-->

  4. fanquake force-pushed on Aug 20, 2026
  5. DrahtBot added the label CI failed on Aug 20, 2026
  6. fanquake force-pushed on Aug 20, 2026
  7. in src/util/syserror.h:11 in 1ce27d26ea
       6 | @@ -7,9 +7,8 @@
       7 |  
       8 |  #include <string>
       9 |  
      10 | -/** Return system error string from errno value. Use this instead of
      11 | - * std::strerror, which is not thread-safe. For network errors use
      12 | - * NetworkErrorString from sock.h instead.
      13 | +/** Return system error string from errno value. For network errors
      14 | + * use NetworkErrorString from sock.h instead.
    


    maflcko commented at 2:42 PM on August 20, 2026:
    /// Return system error string from errno value. For network errors
    /// use NetworkErrorString from sock.h instead.
    

    nit: The different indent looks a bit ugly? Could use a fixed-size doxygen comment?


    fanquake commented at 2:55 PM on August 20, 2026:

    Sure, changed.

  8. fanquake force-pushed on Aug 20, 2026
  9. DrahtBot removed the label CI failed on Aug 20, 2026
  10. fanquake force-pushed on Aug 21, 2026
  11. fanquake force-pushed on Sep 9, 2026
  12. fanquake force-pushed on Sep 11, 2026
  13. fanquake force-pushed on Sep 16, 2026
  14. fanquake force-pushed on Oct 2, 2026
  15. fanquake commented at 10:07 AM on October 2, 2026: member

    Dropped any Windows-specific changes here.

  16. util: remove usage of strerror_s/r
    Use std::system_category().message(err), which internally dispatches to
    strerror_r/s, and should handle unknown errors.
    
    See: https://github.com/llvm/llvm-project/blob/4e9e83400a5702059c8a18e2fb6174038875e8a6/libcxx/src/system_error.cpp#L231
    ec4ae26ba1
  17. in src/util/syserror.cpp:26 in a2b2b75f38 outdated
      22 | -    /* Too bad there are three incompatible implementations of the
      23 | -     * thread-safe strerror. */
      24 | -    const char *s = nullptr;
      25 | -#ifdef WIN32
      26 | -    if (strerror_s(buf, sizeof(buf), err) == 0) s = buf;
      27 | -#else
    


    hebasto commented at 12:20 PM on October 2, 2026:

    Is it safe to remove this Windows-specific code?


    maflcko commented at 7:58 AM on October 13, 2026:
  18. fanquake force-pushed on Oct 13, 2026

github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2026-10-14 17:51 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me