aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSteve Bennett <steveb@workware.net.au>2023-06-19 09:23:52 +1000
committerSteve Bennett <steveb@workware.net.au>2023-07-04 09:23:43 +1000
commit4827854ac5e249ff7f91e9ae0d74f309b2195508 (patch)
tree44c1efd3a4db67f5341b42706ea8a908c8e349b9
parentd6ce55ad7e01a51acb8a2a909383366ecc89d0b2 (diff)
downloadjimtcl-4827854ac5e249ff7f91e9ae0d74f309b2195508.zip
jimtcl-4827854ac5e249ff7f91e9ae0d74f309b2195508.tar.gz
jimtcl-4827854ac5e249ff7f91e9ae0d74f309b2195508.tar.bz2
aio: close should still close AIO_KEEPOPEN channels
AIO_KEEPOPEN won't close a channel (such as stdin, stdout) when the command is deleted/replaced, but an explicit close will still close the channel. Signed-off-by: Steve Bennett <steveb@workware.net.au>
-rw-r--r--jim-aio.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/jim-aio.c b/jim-aio.c
index 0e947db..abc7482 100644
--- a/jim-aio.c
+++ b/jim-aio.c
@@ -1368,12 +1368,12 @@ static int aio_cmd_eof(Jim_Interp *interp, int argc, Jim_Obj *const *argv)
static int aio_cmd_close(Jim_Interp *interp, int argc, Jim_Obj *const *argv)
{
+ AioFile *af = Jim_CmdPrivData(interp);
if (argc == 3) {
int option = -1;
#if defined(HAVE_SOCKETS)
static const char * const options[] = { "r", "w", "-nodelete", NULL };
enum { OPT_R, OPT_W, OPT_NODELETE };
- AioFile *af = Jim_CmdPrivData(interp);
if (Jim_GetEnum(interp, argv[2], options, &option, NULL, JIM_ERRMSG) != JIM_OK) {
return JIM_ERR;
@@ -1403,6 +1403,9 @@ static int aio_cmd_close(Jim_Interp *interp, int argc, Jim_Obj *const *argv)
}
}
+ /* Explicit close ignores AIO_KEEPOPEN */
+ af->flags &= ~AIO_KEEPOPEN;
+
return Jim_DeleteCommand(interp, argv[0]);
}