From 633c545b1d6bd858eab69f8cc7075d3f0368f4ef Mon Sep 17 00:00:00 2001 From: Akira Kakuto Date: Tue, 6 Apr 2021 22:28:30 +0000 Subject: fix a bug that the "nul" device given in a full-path form was not readable (w32 only) git-svn-id: svn://tug.org/texlive/trunk@58778 c570f23f-e606-0410-a88d-b1316a301751 --- Build/source/texk/kpathsea/ChangeLog | 5 +++++ Build/source/texk/kpathsea/knj.c | 14 ++++++++++++-- Build/source/texk/kpathsea/readable.c | 7 ++++++- 3 files changed, 23 insertions(+), 3 deletions(-) diff --git a/Build/source/texk/kpathsea/ChangeLog b/Build/source/texk/kpathsea/ChangeLog index 85061dc53a5..7db205a7c55 100644 --- a/Build/source/texk/kpathsea/ChangeLog +++ b/Build/source/texk/kpathsea/ChangeLog @@ -1,3 +1,8 @@ +2021-04-07 Akira Kakuto + + * knj.c, readable.c: Fix a bug that the "nul" device given in + a full-path form, such as c:/usr/work/nul was not readable. + 2021-03-23 Karl Berry * TL'21. diff --git a/Build/source/texk/kpathsea/knj.c b/Build/source/texk/kpathsea/knj.c index 6aed564ed9f..4cf678483ce 100644 --- a/Build/source/texk/kpathsea/knj.c +++ b/Build/source/texk/kpathsea/knj.c @@ -129,9 +129,14 @@ kpathsea_fsyscp_xfopen (kpathsea kpse, const char *filename, const char *mode) /./ , /../, \.\, \..\ should be excluded. (2020/06/06) More than one adjacent directory separators should be excluded. (2020/10/24) + The "nul" device should be excluded. (2021/04/07). */ fnn = xmalloc(len + 10); - p = strstr(filename, ".\\"); + if (stricmp(filename + len - 3, "nul") == 0) + p = filename; + if (!p) { + p = strstr(filename, ".\\"); + } if (!p) { p = strstr(filename, "./"); } @@ -208,9 +213,14 @@ kpathsea_fsyscp_fopen (kpathsea kpse, const char *filename, const char *mode) /./ , /../, \.\, \..\ should be excluded. (2020/06/06) More than one adjacent directory separators should be excluded. (2020/10/24) + The "nul" device should be excluded. (2021/04/07). */ fnn = xmalloc(len + 10); - p = strstr(filename, ".\\"); + if (stricmp(filename + len - 3, "nul") == 0) + p = filename; + if (!p) { + p = strstr(filename, ".\\"); + } if (!p) { p = strstr(filename, "./"); } diff --git a/Build/source/texk/kpathsea/readable.c b/Build/source/texk/kpathsea/readable.c index 919bfaa0208..c1e1076a1cb 100644 --- a/Build/source/texk/kpathsea/readable.c +++ b/Build/source/texk/kpathsea/readable.c @@ -53,8 +53,13 @@ READABLE(kpathsea kpse, const_string fn, unsigned int st) /../, /./, \..\, \.\ should be excluded (2020/06/06) More than one adjacent directory separators should be excluded. (2020/10/24) + The "nul" device should be excluded. (2021/04/07). */ - p = strstr(fn, ".\\"); + if (stricmp(fn + len - 3, "nul") == 0) + p = fn; + if (!p) { + p = strstr(fn, ".\\"); + } if (!p) { p = strstr(fn, "./"); } -- cgit v1.2.3