When we improved error messages in
cd393cec3ab gdb, btrace: improve error messages
we cleared the original errno. When the error reason can not be explained
in a more detailed error message, and we fall back to the default error
message, it now gives Success as error.
Restore the original errno to fix that.
static void
diagnose_perf_event_open_fail ()
{
- switch (errno)
+ int orig_errno = errno;
+ switch (orig_errno)
{
case EPERM:
case EACCES:
break;
}
- error (_("Failed to start recording: %s"), safe_strerror (errno));
+ error (_("Failed to start recording: %s"), safe_strerror (orig_errno));
}
/* Get the linux version of a btrace_target_info. */