From: Paul Eggert Date: Thu, 27 Nov 2025 19:11:25 +0000 (-0800) Subject: Fix commit typo when bringing back placeholders X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=refs%2Fheads%2Fmaster;p=thirdparty%2Ftar.git Fix commit typo when bringing back placeholders Problem reported by Pavel Raiskup in: https://lists.gnu.org/r/bug-tar/2025-11/msg00028.html * src/extract.c (contains_dot_dot): Bring back this function here, from its former location in src/names.c. Make it static since it is used only in this compilation unit. --- diff --git a/src/extract.c b/src/extract.c index 4345b528..92381edb 100644 --- a/src/extract.c +++ b/src/extract.c @@ -72,6 +72,23 @@ implemented (int err) || (EOPNOTSUPP != ENOTSUP && err == EOPNOTSUPP)); } +/* Return true if NAME contains ".." as a file name component. */ +static bool +contains_dot_dot (char const *name) +{ + char const *p = name + FILE_SYSTEM_PREFIX_LEN (name); + + for (;; p++) + { + if (p[0] == '.' && p[1] == '.' && (ISSLASH (p[2]) || !p[2])) + return true; + + for (; ! ISSLASH (*p); p++) + if (!*p) + return false; + } +} + /* List of directories whose statuses we need to extract after we've finished extracting their subsidiary files. Ordinarily the head of the list has the longest name, and each non-head element is an