diff --git a/src/driver/toks_driver_ctx.c b/src/driver/toks_driver_ctx.c index 718829b..b885453 100644 --- a/src/driver/toks_driver_ctx.c +++ b/src/driver/toks_driver_ctx.c @@ -550,9 +550,11 @@ int toks_get_driver_ctx( if (!(ctx = toks_driver_ctx_alloc(meta,&cctx))) return toks_get_driver_ctx_fail(meta); - if (ctx->rtdata->hroot && cctx.hroot) { + if (ctx->rtdata->hroot && cctx.sysroot) { ntapi->zw_close(ctx->rtdata->hroot); ctx->rtdata->hroot = cctx.hroot; + } else { + cctx.hroot = ctx->rtdata->hroot; } if (cctx.logfile && toks_open_log_file(&hlog,ctx->rtdata->hroot,cctx.logfile,false)) {