summaryrefslogtreecommitdiff
path: root/src/output
diff options
context:
space:
mode:
Diffstat (limited to 'src/output')
-rw-r--r--src/output/sfrt_output_error.c16
1 files changed, 11 insertions, 5 deletions
diff --git a/src/output/sfrt_output_error.c b/src/output/sfrt_output_error.c
index 46b637b..155e009 100644
--- a/src/output/sfrt_output_error.c
+++ b/src/output/sfrt_output_error.c
@@ -52,7 +52,9 @@ static const char * sfrt_output_unit_header(const struct sfrt_error_info * erri)
return "while parsing";
}
-static const char * sfrt_output_strerror(const struct sfrt_error_info * erri)
+static const char * sfrt_output_strerror(
+ const struct sfrt_error_info * erri,
+ char (*errbuf)[256])
{
if (erri->eflags & SFRT_ERROR_CUSTOM)
return ((erri->elibcode < 0) || (erri->elibcode >= SFRT_ERR_CAP))
@@ -69,7 +71,9 @@ static const char * sfrt_output_strerror(const struct sfrt_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 sfrt_output_error_record_plain(
@@ -77,7 +81,8 @@ static int sfrt_output_error_record_plain(
const struct sfrt_error_info * erri)
{
const char * epath;
- const char * errdesc = sfrt_output_strerror(erri);
+ char errbuf[256];
+ const char * errdesc = sfrt_output_strerror(erri,&errbuf);
int fderr = sfrt_driver_fderr(dctx);
epath = erri->euctx
@@ -112,7 +117,8 @@ static int sfrt_output_error_record_annotated(
const struct sfrt_error_info * erri)
{
const char * epath;
- const char * errdesc = sfrt_output_strerror(erri);
+ char errbuf[256];
+ const char * errdesc = sfrt_output_strerror(erri,&errbuf);
int fderr = sfrt_driver_fderr(dctx);
epath = erri->euctx
@@ -159,7 +165,7 @@ static int sfrt_output_error_record_annotated(
strlen(errdesc) ? ": " : "",
aclr_bold,
- sfrt_output_strerror(erri),
+ errdesc,
aclr_reset) < 0)
return -1;