-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA256 On 16.07.2015 10:25, Pierre Pronchery wrote: > Hi, > > On 07/16/15 02:04, Kamil Rytarowski wrote: >> Module Name: src Committed By: kamil Date: Thu Jul 16 >> 00:04:00 >> UTC 2015 >> >> Modified Files: src/lib/libc/stdlib: reallocarr.c >> >> Log Message: Reorder memcpy(3) and save errno >> >> This chang is for safety as memcpy(3) might change it. > > I am not against the change, but are you sure memcpy(3) has any > chance to change errno? I think it would actually be a bug if it > does, since it is not meant to fail, and it is a pretty essential > component for error recovery (writing messages...). > > This is not a definite answer but: $ find > NetBSD/src/common/lib/libc -name memcpy.S -exec grep errno {} \+ > does not report anything. > > Anyway, HTH, >
I will use this function outside the NetBSD world. My intention is to push it to libnbcompat. Before that I removed the possible thin-skinned point. The C standard permits memcpy(3) to affect errno(2). I'm not much interested in debate what platforms do it and whether they are sane or not, this change just cuts this discussion down. Last year the GCC(1) team debated the support of platforms clobbering errno(2) in the memcpy(9) function. https://gcc.gnu.org/bugzilla/show_bug.cgi?id=56888 Just better to do it now then wait for timer bomb to explode. For most of the users this change is non-functional. -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQIcBAEBCAAGBQJVp4OIAAoJEEuzCOmwLnZstk8QALw6r4V+JDdJvi7ru4dqGWwm 5HjnM+YbmEjcbcunctZtPYXNLLl5c2KedBDaSmrZ6AJ192Xk7SCFR2jzZmQ/nO+G xXp8yAp1bIqh/wM+FXtaeQYq7pc8z7ckvi9E7nreoife+kHC6fDuvhp9i6As5DoK Vhqp9XaZfdCX7aWdkwlvf1gO7CpuBuvFNBD+9m80ganJ6Bwk/0Lv+hp+r2q6kQCC 9quq5GfAYwMpB0VVb2mtEVOo2wxBeFFk866lyiiZH6jf9PI8C2Igg7S2ljr463kv p/DDgKWlY26FLkmagOaLyIGyQpni0Gw+XZg8qwAJ/H8UETls6XLLk5XPS5FbaoFc xEgNVHYU3RxO/1eDyvtQGuKuoDfTFqIXVnsvBqhoGNBNSENwcgwc0AXcnWgbw/IY CgIh80FUfrWvbnoxajgBGzVzOs4yjKpWcjbVrJl2tfjLCuQ/99EFptBuBBZWaquO loqlqCO5MTWPeG3GUecUXBDZK6CJVf/Uz9II6YBSOXjTzIkGbVIev0beKMmXePEJ KcxkStaFvVYIJ9Qbyzhd0/o03KZp2BM1tu1bIseHd1L9JNtleNLMSxb6WFDx69D2 ggmGgA9w4ySM7N/c2BEuKUurRRd4uElj2eJAnifSkaLhLg8184XK/0OFvLMVyFAJ PUpnHTlLhZ9N7y3hn2/Z =cZYP -----END PGP SIGNATURE-----