generates fmap from desc if no map is NULL

This commit is contained in:
Kevin Lin
2015-03-03 17:47:55 -05:00
parent 8e7042beb9
commit 116169833d

View File

@@ -3476,9 +3476,25 @@ static int scan_common(int desc, cl_fmap_t *map, const char **virname, unsigned
rc = CL_EMEM;
}
else {
cli_bytecode_context_setctx(bc_ctx, &ctx);
rc = cli_bytecode_runhook(&ctx, ctx.engine, bc_ctx, BC_PRECLASS, map);
cli_bytecode_context_destroy(bc_ctx);
fmap_t *pc_map = map;
if (!pc_map) {
perf_start(&ctx, PERFT_MAP);
if(!(pc_map = fmap(desc, 0, sb.st_size))) {
perf_stop(&ctx, PERFT_MAP);
rc = CL_EMEM;
}
perf_stop(&ctx, PERFT_MAP);
}
if (pc_map) {
cli_bytecode_context_setctx(bc_ctx, &ctx);
rc = cli_bytecode_runhook(&ctx, ctx.engine, bc_ctx, BC_PRECLASS, pc_map);
cli_bytecode_context_destroy(bc_ctx);
if (!map)
funmap(pc_map);
}
}
//ctx.options &= ~CL_SCAN_FILE_PROPERTIES;
//rc = cli_mem_scandesc(jstring, strlen(jstring), &ctx);