From 2552127266f4a79f05f7defb7e030ab989849733 Mon Sep 17 00:00:00 2001 From: midipix Date: Jul 03 2020 15:54:54 +0000 Subject: driver: toks_main(): process the abort request after all other requests. --- diff --git a/src/driver/toks_amain.c b/src/driver/toks_amain.c index c83737b..7a92ce6 100644 --- a/src/driver/toks_amain.c +++ b/src/driver/toks_amain.c @@ -150,31 +150,6 @@ int toks_main(char ** argv, char ** envp) } } - if (dctx->cctx->drvflags & TOKS_DRIVER_ACTION_ABORT) { - ret = (status = toks_service_abort(dctx)) - ? 2 : 0; - - switch (status) { - case NT_STATUS_SUCCESS: - toks_dprintf(STDERR_FILENO, - "%s: the server responded with no error.\n", - toks_log_basename(argv[0]),status); - break; - - case NT_STATUS_ACCESS_DENIED: - toks_dprintf(STDERR_FILENO, - "%s: the abort operataion timed (access denied) [0x%x].\n", - toks_log_basename(argv[0]),status); - break; - - default: - toks_dprintf(STDERR_FILENO, - "%s: the abort operataion failed ", - "(check the system's documentation) [0x%x].", - toks_log_basename(argv[0]),status); - } - } - if (dctx->cctx->drvflags & TOKS_DRIVER_ACTION_NTOKENS_GET) { toks_dprintf(STDOUT_FILENO, "toks_ntokens:%d\n", @@ -278,6 +253,31 @@ int toks_main(char ** argv, char ** envp) } } + if (dctx->cctx->drvflags & TOKS_DRIVER_ACTION_ABORT) { + ret = (status = toks_service_abort(dctx)) + ? 2 : 0; + + switch (status) { + case NT_STATUS_SUCCESS: + toks_dprintf(STDERR_FILENO, + "%s: the server responded with no error.\n", + toks_log_basename(argv[0]),status); + break; + + case NT_STATUS_ACCESS_DENIED: + toks_dprintf(STDERR_FILENO, + "%s: the abort operataion timed (access denied) [0x%x].\n", + toks_log_basename(argv[0]),status); + break; + + default: + toks_dprintf(STDERR_FILENO, + "%s: the abort operataion failed ", + "(check the system's documentation) [0x%x].", + toks_log_basename(argv[0]),status); + } + } + return (dctx->cctx->drvflags & TOKS_DRIVER_MODE_SERVER) ? NT_STATUS_SERVICE_NOTIFICATION : toks_exit(dctx,ret);