summaryrefslogtreecommitdiff
path: root/src/output
diff options
context:
space:
mode:
authormidipix <writeonce@midipix.org>2016-10-24 21:42:41 -0400
committermidipix <writeonce@midipix.org>2016-11-10 23:35:53 -0500
commit251206109d1c2d9c52dc63bbce431685fbabf0a7 (patch)
tree61ce045da2207ce6cf9a7d504c499377dda78ed5 /src/output
parent68f5d95a7ae35f7284769db992069eab119793ba (diff)
downloadperk-251206109d1c2d9c52dc63bbce431685fbabf0a7.tar.bz2
perk-251206109d1c2d9c52dc63bbce431685fbabf0a7.tar.xz
pe_output_import_libraries(): added error trace support.
Diffstat (limited to 'src/output')
-rw-r--r--src/output/pe_output_import_libraries.c25
1 files changed, 16 insertions, 9 deletions
diff --git a/src/output/pe_output_import_libraries.c b/src/output/pe_output_import_libraries.c
index a2eb01b..95920ab 100644
--- a/src/output/pe_output_import_libraries.c
+++ b/src/output/pe_output_import_libraries.c
@@ -13,6 +13,7 @@
#include <perk/perk.h>
#include <perk/perk_output.h>
#include "perk_output_impl.h"
+#include "perk_errinfo_impl.h"
static int pretty_header(const struct pe_common_ctx * cctx, FILE * fout)
{
@@ -42,26 +43,31 @@ static int pretty_implib_item(const struct pe_common_ctx * cctx, const char * na
}
int pe_output_import_libraries(
+ const struct pe_driver_ctx * dctx,
const struct pe_image_meta * m,
- const struct pe_common_ctx * cctx,
FILE * fout)
{
- FILE * ftmp;
- int i;
- unsigned j;
+ FILE * ftmp;
+ int i;
+ unsigned j;
+ const struct pe_common_ctx * cctx = dctx->cctx;
if (!m->summary.nimplibs)
return 0;
if (!(fout = pe_output_prolog(cctx,fout,&ftmp)))
- return -1;
+ return PERK_SYSTEM_ERROR(dctx);
if ((pretty_header(cctx,fout)) < 0)
- return pe_output_epilog(-1,ftmp);
+ return pe_output_epilog(
+ PERK_FILE_ERROR(dctx),
+ ftmp);
for (i=0; i<m->summary.nimplibs; i++) {
if ((pretty_implib_header(cctx,m->idata[i].name,fout)) < 0)
- return pe_output_epilog(-1,ftmp);
+ return pe_output_epilog(
+ PERK_FILE_ERROR(dctx),
+ ftmp);
if (cctx->fmtflags & PERK_OUTPUT_IMPORT_SYMS)
for (j=0; j<m->idata[i].count; j++)
@@ -70,8 +76,9 @@ int pe_output_import_libraries(
cctx,
m->idata[i].items[j].name,
fout)) < 0)
- return pe_output_epilog(-1,ftmp);
-
+ return pe_output_epilog(
+ PERK_FILE_ERROR(dctx),
+ ftmp);
}
return pe_output_epilog(0,ftmp);