summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authormidipix <writeonce@midipix.org>2024-05-30 00:39:28 +0000
committermidipix <writeonce@midipix.org>2024-05-30 00:41:06 +0000
commit8c58594be4cb5b72ccb854a800c33bf4b8ade265 (patch)
tree8606acd65a82d2ea34be13e1b49de69a978723fa
parent31d5a4814e867f542182112aed3dedabe8031730 (diff)
downloadtpax-8c58594be4cb5b72ccb854a800c33bf4b8ade265.tar.bz2
tpax-8c58594be4cb5b72ccb854a800c33bf4b8ade265.tar.xz
driver: verifier that the request blksize is a multiple of 512 bytes.
-rw-r--r--src/driver/tpax_driver_ctx.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/src/driver/tpax_driver_ctx.c b/src/driver/tpax_driver_ctx.c
index b1393d2..6bb7545 100644
--- a/src/driver/tpax_driver_ctx.c
+++ b/src/driver/tpax_driver_ctx.c
@@ -242,6 +242,22 @@ static int tpax_driver_usage_block_size_range(
return TPAX_USAGE;
}
+static int tpax_driver_usage_block_constraints(
+ int fdout,
+ const char * program,
+ const char * arg,
+ struct argv_meta * meta)
+{
+ tpax_dprintf(
+ fdout,
+ "%s: usage error: the specified block size `%s' is not a multiple of 512 bytes.\n",
+ program,arg);
+
+ argv_free(meta);
+
+ return TPAX_USAGE;
+}
+
static int tpax_driver_error_archive_path(
int fdout,
const char * program,
@@ -480,6 +496,12 @@ int tpax_lib_get_driver_ctx(
fdctx->fderr,
program,entry->arg,
optv,meta);
+
+ if (cctx.blksize % 512)
+ return tpax_driver_usage_block_constraints(
+ fdctx->fderr,
+ program,entry->arg,
+ meta);
break;
case TAG_RECURSE: