summaryrefslogtreecommitdiff
path: root/src/driver
diff options
context:
space:
mode:
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);
}