From 90dec1cc53b8297fafc710e5cc57c8ba8a1fb9bb Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Tue, 7 Apr 2026 11:11:21 -0700 Subject: [PATCH] --one-top-level now keeps "../" and ".../" * src/list.c (enforce_one_top_level): Do not strip prefixes like "../" (which should not be allowed unless -P) and ".../" (which are ordinary file names). The "../" not being allowed should be addressed in a different way. --- src/list.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/list.c b/src/list.c index 8e9caf5c..14050cfb 100644 --- a/src/list.c +++ b/src/list.c @@ -120,8 +120,16 @@ enforce_one_top_level (char **pfile_name) char *file_name = *pfile_name; char *p; - for (p = file_name; *p && (ISSLASH (*p) || *p == '.'); p++) - ; + for (p = file_name; ; p++) + { + bool dot = p[0] == '.'; + if (!ISSLASH (p[dot])) + { + p += dot & !p[dot]; + break; + } + p += dot; + } if (*p) {