summaryrefslogtreecommitdiffhomepage
path: root/src/output
diff options
context:
space:
mode:
Diffstat (limited to 'src/output')
-rw-r--r--src/output/mdso_output_error.c18
1 files changed, 13 insertions, 5 deletions
diff --git a/src/output/mdso_output_error.c b/src/output/mdso_output_error.c
index 9ae5e30..6a382b7 100644
--- a/src/output/mdso_output_error.c
+++ b/src/output/mdso_output_error.c
@@ -62,7 +62,9 @@ static const char * mdso_output_unit_header(const struct mdso_error_info * erri)
return "while parsing";
}
-static const char * mdso_output_strerror(const struct mdso_error_info * erri)
+static const char * mdso_output_strerror(
+ const struct mdso_error_info * erri,
+ char (*errbuf)[256])
{
if (erri->eflags & MDSO_ERROR_CUSTOM)
return ((erri->elibcode < 0) || (erri->elibcode >= MDSO_ERR_CAP))
@@ -79,7 +81,9 @@ static const char * mdso_output_strerror(const struct mdso_error_info * erri)
return "input error: string length exceeds buffer size.";
else
- return strerror(erri->esyscode);
+ return strerror_r(erri->esyscode,*errbuf,sizeof(*errbuf))
+ ? "internal error: strerror_r(3) call failed"
+ : *errbuf;
}
static int mdso_output_error_record_plain(
@@ -87,8 +91,10 @@ static int mdso_output_error_record_plain(
const struct mdso_error_info * erri)
{
const char * epath;
- const char * errdesc = mdso_output_strerror(erri);
+ char errbuf[256];
+
int fderr = mdso_driver_fderr(dctx);
+ const char * errdesc = mdso_output_strerror(erri,&errbuf);
epath = erri->euctx
? *erri->euctx->path
@@ -122,8 +128,10 @@ static int mdso_output_error_record_annotated(
const struct mdso_error_info * erri)
{
const char * epath;
- const char * errdesc = mdso_output_strerror(erri);
+ char errbuf[256];
+
int fderr = mdso_driver_fderr(dctx);
+ const char * errdesc = mdso_output_strerror(erri,&errbuf);
epath = erri->euctx
? *erri->euctx->path
@@ -169,7 +177,7 @@ static int mdso_output_error_record_annotated(
strlen(errdesc) ? ": " : "",
aclr_bold,
- mdso_output_strerror(erri),
+ errdesc,
aclr_reset) < 0)
return -1;