Browse code

bytecode: first close then unlink.

should fix win32.

Török Edvin authored on 2010/05/16 05:36:12
Showing 1 changed files
... ...
@@ -130,6 +130,9 @@ static int cli_bytecode_context_reset(struct cli_bc_ctx *ctx)
130 130
 	cli_bcapi_extract_new(ctx, -1);
131 131
 	if (ctx->outfd)
132 132
 	    close(ctx->outfd);
133
+	if (ctx->tempfile && (!cctx || !cctx->engine->keeptmp)) {
134
+	    cli_unlink(ctx->tempfile);
135
+	}
133 136
 	free(ctx->tempfile);
134 137
 	ctx->tempfile = NULL;
135 138
 	ctx->outfd = 0;
... ...
@@ -210,9 +213,6 @@ static int cli_bytecode_context_reset(struct cli_bc_ctx *ctx)
210 210
 int cli_bytecode_context_clear(struct cli_bc_ctx *ctx)
211 211
 {
212 212
     cli_ctx *cctx = (cli_ctx*)ctx->ctx;
213
-    if (ctx->tempfile && (!cctx || !cctx->engine->keeptmp)) {
214
-	cli_unlink(ctx->tempfile);
215
-    }
216 213
     cli_bytecode_context_reset(ctx);
217 214
     memset(ctx, 0, sizeof(*ctx));
218 215
     return CL_SUCCESS;