From ffd562ecf44aff10b74c35c6f961614db5198ca9 Mon Sep 17 00:00:00 2001 From: Carlos Maiolino Date: Sun, 21 Dec 2025 11:24:50 +0100 Subject: [PATCH] punch-alternating: prevent punching all extents If by any chance the punch size is >= the interval, we end up punching everything, zeroing out the file. As this is not a tool to dealloc the whole file, so force the user to pass a configuration that won't cause it to happen. Signed-off-by: Carlos Maiolino Signed-off-by: Carlos Maiolino Reviewed-by: Zorro Lang Signed-off-by: Zorro Lang --- src/punch-alternating.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/punch-alternating.c b/src/punch-alternating.c index d2bb4b6a..c555b48d 100644 --- a/src/punch-alternating.c +++ b/src/punch-alternating.c @@ -88,6 +88,11 @@ int main(int argc, char *argv[]) usage(argv[0]); } + if (size >= interval) { + printf("Interval must be > size\n"); + usage(argv[0]); + } + if (optind != argc - 1) usage(argv[0]); -- 2.47.3