summaryrefslogtreecommitdiff
path: root/src/driver
diff options
context:
space:
mode:
authormidipix <writeonce@midipix.org>2024-05-26 03:22:34 +0000
committermidipix <writeonce@midipix.org>2024-05-26 03:42:16 +0000
commit5ce6ff10c2cced4bf75db11b16984d565cf1ebec (patch)
treeafca7a6eda843acd738b1ca349366688fa5d9ec3 /src/driver
parentde63a008bfb04739bd189ed183e1dbd656ec4183 (diff)
downloadtpax-5ce6ff10c2cced4bf75db11b16984d565cf1ebec.tar.bz2
tpax-5ce6ff10c2cced4bf75db11b16984d565cf1ebec.tar.xz
logic: tpax_archive_write(): initial implementation and integration.
Diffstat (limited to 'src/driver')
-rw-r--r--src/driver/tpax_amain.c17
1 files changed, 15 insertions, 2 deletions
diff --git a/src/driver/tpax_amain.c b/src/driver/tpax_amain.c
index 293535a..9e76d08 100644
--- a/src/driver/tpax_amain.c
+++ b/src/driver/tpax_amain.c
@@ -57,6 +57,20 @@ static void tpax_perform_unit_actions(
tpax_archive_append_item(dctx,uctx);
}
+static void tpax_archive_write_and_seal(
+ const struct tpax_driver_ctx * dctx)
+{
+ if (tpax_archive_write(dctx) == TPAX_OK)
+ tpax_archive_seal(dctx);
+}
+
+static void tpax_perform_archive_actions(
+ const struct tpax_driver_ctx * dctx)
+{
+ if (dctx->cctx->drvflags & TPAX_DRIVER_EXEC_MODE_WRITE)
+ tpax_archive_write_and_seal(dctx);
+}
+
static int tpax_exit(struct tpax_driver_ctx * dctx, int ret)
{
tpax_output_error_vector(dctx);
@@ -94,8 +108,7 @@ int tpax_main(char ** argv, char ** envp, const struct tpax_fd_ctx * fdctx)
}
}
- if ((dctx->cctx->drvflags & TPAX_DRIVER_EXEC_MODE_WRITE) && dctx->units[0])
- tpax_archive_seal(dctx);
+ tpax_perform_archive_actions(dctx);
return tpax_exit(dctx,dctx->errv[0] ? TPAX_ERROR : TPAX_OK);
}