summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authormidipix <writeonce@midipix.org>2024-08-16 02:19:00 +0000
committermidipix <writeonce@midipix.org>2024-08-16 02:19:00 +0000
commit1360348541c429a6e7bcb3e115c429e922f42243 (patch)
treeba9b31cb28c412181b8d7350133eb1c923c56dc9
parent0496f2b456eedce5c2c6503931374523aabe7018 (diff)
downloadptycon-1360348541c429a6e7bcb3e115c429e922f42243.tar.bz2
ptycon-1360348541c429a6e7bcb3e115c429e922f42243.tar.xz
ptyc_spawn(): reset the value of the context's cctx.hpts as needed.
-rw-r--r--src/pty/ptyc_spawn.c10
1 files 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;