From 4275a94c9d0e8ab2dee4632b6bee32fd634f4460 Mon Sep 17 00:00:00 2001 From: midipix Date: Sun, 9 Jun 2024 04:29:32 +0000 Subject: driver: implemented and integrated the -X (strict device id) cmdline option. --- src/driver/tpax_driver_ctx.c | 4 ++++ src/internal/tpax_driver_impl.h | 1 + src/logic/tpax_archive_enqueue.c | 5 +++++ src/skin/tpax_skin_default.c | 5 +++++ 4 files changed, 15 insertions(+) (limited to 'src') diff --git a/src/driver/tpax_driver_ctx.c b/src/driver/tpax_driver_ctx.c index d2fec77..79518f0 100644 --- a/src/driver/tpax_driver_ctx.c +++ b/src/driver/tpax_driver_ctx.c @@ -544,6 +544,10 @@ int tpax_lib_get_driver_ctx( cctx.drvflags |= TPAX_DRIVER_PAX_SYMLINK_ITEMS; break; + case TAG_STRICT_DEVICE_ID: + cctx.drvflags |= TPAX_DRIVER_STRICT_DEVICE_ID; + break; + case TAG_STRICT_PATH: cctx.drvflags |= TPAX_DRIVER_STRICT_PATH_INPUT; break; diff --git a/src/internal/tpax_driver_impl.h b/src/internal/tpax_driver_impl.h index 23e9e23..2bcb486 100644 --- a/src/internal/tpax_driver_impl.h +++ b/src/internal/tpax_driver_impl.h @@ -51,6 +51,7 @@ enum app_tags { TAG_PRESERVE_ATIME, TAG_PAX_SYMLINK_ARGS, TAG_PAX_SYMLINK_ITEMS, + TAG_STRICT_DEVICE_ID, }; struct tpax_dirent { diff --git a/src/logic/tpax_archive_enqueue.c b/src/logic/tpax_archive_enqueue.c index 0d8c28f..8685cad 100644 --- a/src/logic/tpax_archive_enqueue.c +++ b/src/logic/tpax_archive_enqueue.c @@ -304,6 +304,11 @@ static int tpax_archive_enqueue_dir_entries( TPAX_CUSTOM_ERROR(dctx,TPAX_ERR_FLOW_ERROR), uctx); + /* ensure physical device identity as needed */ + if (dctx->cctx->drvflags & TPAX_DRIVER_STRICT_DEVICE_ID) + if (dent->parent && (uctx->st->st_dev != dent->parent->stdev)) + return 0; + /* obtain buffer for file-system directory entries */ dirents = tpax_get_driver_getdents_buffer(dctx); dirent = dirents; diff --git a/src/skin/tpax_skin_default.c b/src/skin/tpax_skin_default.c index ffbc2d2..33ab8b8 100644 --- a/src/skin/tpax_skin_default.c +++ b/src/skin/tpax_skin_default.c @@ -88,6 +88,11 @@ const tpax_hidden struct argv_option tpax_default_options[] = { "or directory to the archive using the name of the " "symbolic link."}, + {"Wstrict-device-id", + 'X',TAG_STRICT_DEVICE_ID,ARGV_OPTARG_NONE, + ARGV_OPTION_HYBRID_ONLY,0,0, + "do not recurse into directories across device boundaries"}, + {"Wstrict-path-input", 0,TAG_STRICT_PATH,ARGV_OPTARG_NONE, ARGV_OPTION_HYBRID_ONLY,0,0, -- cgit v1.2.3