summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/driver/pe_amain.c8
-rw-r--r--src/output/pe_output_import_libraries.c25
2 files changed, 21 insertions, 12 deletions
diff --git a/src/driver/pe_amain.c b/src/driver/pe_amain.c
index caebe58..142db3b 100644
--- a/src/driver/pe_amain.c
+++ b/src/driver/pe_amain.c
@@ -59,7 +59,9 @@ static ssize_t pe_paragraph_break(struct pe_unit_ctx * uctx, int * fpara)
return 0;
}
-static void pe_perform_unit_actions(struct pe_unit_ctx * uctx)
+static void pe_perform_unit_actions(
+ const struct pe_driver_ctx * dctx,
+ struct pe_unit_ctx * uctx)
{
int fpara = 0;
uint64_t flags = uctx->cctx->fmtflags;
@@ -72,7 +74,7 @@ static void pe_perform_unit_actions(struct pe_unit_ctx * uctx)
if ((flags & PERK_OUTPUT_IMPORT_LIBS) || (flags & PERK_OUTPUT_IMPORT_SYMS)) {
pe_paragraph_break(uctx,&fpara);
- uctx->status = pe_output_import_libraries(uctx->meta,uctx->cctx,0);
+ uctx->status = pe_output_import_libraries(dctx,uctx->meta,0);
uctx->nerrors += !!uctx->status;
fpara += (uctx->meta->summary.nimplibs > 0);
}
@@ -100,7 +102,7 @@ int pe_main(int argc, char ** argv, char ** envp)
for (unit=dctx->units; *unit; unit++) {
if (!(pe_get_unit_ctx(dctx,*unit,&uctx))) {
- pe_perform_unit_actions(uctx);
+ pe_perform_unit_actions(dctx,uctx);
ret += uctx->nerrors;
pe_free_unit_ctx(uctx);
}
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);