mirror of
https://github.com/yuzu-emu/unicorn.git
synced 2025-01-11 06:55:37 +00:00
error: error_setg_errno(): errno gets preserved
C11 allows errno to be clobbered by pretty much any library function call, so in general callers need to take care to save errno before calling other functions. However, for error reporting functions this is rather awkward and can make the code on the caller side more complicated than necessary. error_setg_errno() already takes care of preserving errno and some functions rely on that, so just promise that we continue to do so in the future. Backports commit 98cb89af4df7e1776ce418ed6167b6e214a64435 from qemu
This commit is contained in:
parent
aca671b3b1
commit
11c66029b7
|
@ -172,6 +172,9 @@ void error_setg_internal(Error **errp,
|
||||||
* Just like error_setg(), with @os_error info added to the message.
|
* Just like error_setg(), with @os_error info added to the message.
|
||||||
* If @os_error is non-zero, ": " + strerror(os_error) is appended to
|
* If @os_error is non-zero, ": " + strerror(os_error) is appended to
|
||||||
* the human-readable error message.
|
* the human-readable error message.
|
||||||
|
*
|
||||||
|
* The value of errno (which usually can get clobbered by almost any
|
||||||
|
* function call) will be preserved.
|
||||||
*/
|
*/
|
||||||
#define error_setg_errno(errp, os_error, fmt, ...) \
|
#define error_setg_errno(errp, os_error, fmt, ...) \
|
||||||
error_setg_errno_internal((errp), __FILE__, __LINE__, __func__, \
|
error_setg_errno_internal((errp), __FILE__, __LINE__, __func__, \
|
||||||
|
|
Loading…
Reference in a new issue