diff options
Diffstat (limited to 'futility/cmd_sign.c')
-rw-r--r-- | futility/cmd_sign.c | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/futility/cmd_sign.c b/futility/cmd_sign.c index a983a222..dd28aec4 100644 --- a/futility/cmd_sign.c +++ b/futility/cmd_sign.c @@ -330,6 +330,8 @@ static int do_sign(int argc, char *argv[]) int errorcnt = 0; struct futil_traverse_state_s state; char *e = 0; + uint8_t *buf; + uint32_t buf_len; opterr = 0; /* quiet, you */ while ((i = getopt_long(argc, argv, short_opts, long_opts, 0)) != -1) { @@ -465,12 +467,20 @@ static int do_sign(int argc, char *argv[]) return 1; } + if (0 != futil_map_file(fd, MAP_RW, &buf, &buf_len)) { + errorcnt++; + goto boo; + } + memset(&state, 0, sizeof(state)); state.in_filename = outfile ? outfile : "<none>"; state.op = FUTIL_OP_SIGN; - errorcnt += futil_traverse(fd, &state, MAP_RW); + errorcnt += futil_traverse(buf, buf_len, &state, FILE_TYPE_UNKNOWN); + + errorcnt += futil_unmap_file(fd, MAP_RO, buf, buf_len); +boo: if (close(fd)) { errorcnt++; fprintf(stderr, "Error when closing %s: %s\n", |