From 1360348541c429a6e7bcb3e115c429e922f42243 Mon Sep 17 00:00:00 2001 From: midipix Date: Fri, 16 Aug 2024 02:19:00 +0000 Subject: ptyc_spawn(): reset the value of the context's cctx.hpts as needed. --- src/pty/ptyc_spawn.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/pty/ptyc_spawn.c b/src/pty/ptyc_spawn.c index f65aa53..d34cc53 100644 --- a/src/pty/ptyc_spawn.c +++ b/src/pty/ptyc_spawn.c @@ -117,9 +117,13 @@ int ptyc_spawn(struct ptyc_driver_ctx * dctx) return NT_STATUS_GENERIC_COMMAND_FAILED; /* finalize */ - if (!(dctx->cctx->drvflags & (PTYC_DRIVER_DBG_RAW|PTYC_DRIVER_DBG_OVEN))) - if ((status = ntapi->pty_close(ictx->cctx.hpts))) - return status; + if (dctx->cctx->drvflags & (PTYC_DRIVER_DBG_RAW|PTYC_DRIVER_DBG_OVEN)) + return NT_STATUS_SUCCESS; + + if ((status = ntapi->pty_close(ictx->cctx.hpts))) + return status; + + ictx->cctx.hpts = 0; /* all done */ return NT_STATUS_SUCCESS; -- cgit v1.2.3