]> git.ipfire.org Git - thirdparty/gcc.git/commit
libstdc++: Fix std::random_device for avr
authorJonathan Wakely <jwakely@redhat.com>
Tue, 31 Jan 2023 22:28:16 +0000 (22:28 +0000)
committerJonathan Wakely <jwakely@redhat.com>
Thu, 2 Feb 2023 09:34:15 +0000 (09:34 +0000)
commitcc0394346ac49659d446b2ef35c40ba1ef3cd117
tree150be6220067f26de3f63659f95b29e0c0eff001
parentaa18735f7aa99b40c56b3e3aacb1b28cb805bb90
libstdc++: Fix std::random_device for avr

This fixes a build failure that affects avr, but could affect other
targets in theory. The _M_fini function should not try to use ::open or
::fopen if _GLIBCXX_USE_DEV_RANDOM is not defined, because no file can
ever have been opened.

libstdc++-v3/ChangeLog:

* src/c++11/random.cc (random_device::_M_fini): Do not try to
close the file handle if the target doesn't support the
/dev/random and /dev/urandom files.

(cherry picked from commit 277dd6ea416718ba5493023b5a4660ecdbaf936c)
libstdc++-v3/src/c++11/random.cc