summaryrefslogtreecommitdiffhomepage
path: root/src/pty/ptyc_spawn.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/pty/ptyc_spawn.c')
-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;