From 76aabf2c240c67ede7734f544be94f64da2c55c5 Mon Sep 17 00:00:00 2001 From: midipix Date: Sun, 6 Dec 2015 08:28:32 -0500 Subject: API redesign 6/10: pe_common_ctx: protect i/o members against direct modification. --- src/internal/perk_impl.h | 2 ++ src/internal/perk_output_impl.h | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) (limited to 'src/internal') diff --git a/src/internal/perk_impl.h b/src/internal/perk_impl.h index 77a64ae..7cfc590 100644 --- a/src/internal/perk_impl.h +++ b/src/internal/perk_impl.h @@ -9,6 +9,7 @@ #include struct pe_driver_ctx_impl { + struct pe_io_ctx ioctx; struct pe_common_ctx cctx; struct pe_driver_ctx ctx; }; @@ -17,6 +18,7 @@ struct pe_unit_ctx_impl { const char * path; struct pe_raw_image map; struct pe_image_meta * meta; + struct pe_io_ctx ioctx; struct pe_common_ctx cctx; struct pe_unit_ctx uctx; }; diff --git a/src/internal/perk_output_impl.h b/src/internal/perk_output_impl.h index d6f328a..62f0322 100644 --- a/src/internal/perk_output_impl.h +++ b/src/internal/perk_output_impl.h @@ -14,10 +14,10 @@ static inline FILE * pe_output_prolog( return fout; else if (!cctx) return 0; - else if (cctx->fdout < 0) + else if (cctx->ioctx->fdout < 0) return stdout; - if ((fdout = dup(cctx->fdout)) < 0) + if ((fdout = dup(cctx->ioctx->fdout)) < 0) return 0; if ((*ftmp = fdopen(fdout,"a"))) -- cgit v1.2.3