Port double-slash test to z/OS
* admin/merge-gnulib (GNULIB_MODULES): Add double-slash-root. Emacs was already using this Gnulib module indirectly, so this is merely noting that there is now a direct dependency. * lib/gnulib.mk.in, m4/gnulib-comp.m4: Regenerate. * src/fileio.c (search_embedded_absfilename): Use DOUBLE_SLASH_IS_DISTINCT_ROOT instead of (WINDOWSNT || CYGWIN). Simplify.
This commit is contained in:
parent
f2cc674ebc
commit
50126f2049
4 changed files with 14 additions and 13 deletions
|
@ -31,7 +31,7 @@ GNULIB_MODULES='
|
|||
careadlinkat close-stream copy-file-range
|
||||
count-leading-zeros count-one-bits count-trailing-zeros
|
||||
crypto/md5-buffer crypto/sha1-buffer crypto/sha256-buffer crypto/sha512-buffer
|
||||
d-type diffseq dosname dtoastr dtotimespec dup2
|
||||
d-type diffseq dosname double-slash-root dtoastr dtotimespec dup2
|
||||
environ execinfo explicit_bzero faccessat
|
||||
fcntl fcntl-h fdopendir
|
||||
filemode filevercmp flexmember fpieee fstatat fsusage fsync
|
||||
|
|
|
@ -86,6 +86,7 @@
|
|||
# d-type \
|
||||
# diffseq \
|
||||
# dosname \
|
||||
# double-slash-root \
|
||||
# dtoastr \
|
||||
# dtotimespec \
|
||||
# dup2 \
|
||||
|
|
|
@ -70,6 +70,7 @@ AC_DEFUN([gl_EARLY],
|
|||
# Code from module dirent:
|
||||
# Code from module dirfd:
|
||||
# Code from module dosname:
|
||||
# Code from module double-slash-root:
|
||||
# Code from module dtoastr:
|
||||
# Code from module dtotimespec:
|
||||
# Code from module dup2:
|
||||
|
@ -227,6 +228,7 @@ AC_DEFUN([gl_INIT],
|
|||
gl_SHA512
|
||||
gl_CHECK_TYPE_STRUCT_DIRENT_D_TYPE
|
||||
gl_DIRENT_H
|
||||
gl_DOUBLE_SLASH_ROOT
|
||||
gl_FUNC_DUP2
|
||||
if test $HAVE_DUP2 = 0 || test $REPLACE_DUP2 = 1; then
|
||||
AC_LIBOBJ([dup2])
|
||||
|
|
22
src/fileio.c
22
src/fileio.c
|
@ -1778,20 +1778,18 @@ get_homedir (void)
|
|||
static char *
|
||||
search_embedded_absfilename (char *nm, char *endp)
|
||||
{
|
||||
char *p, *s;
|
||||
|
||||
for (p = nm + 1; p < endp; p++)
|
||||
char *p = nm + 1;
|
||||
#ifdef DOUBLE_SLASH_IS_DISTINCT_ROOT
|
||||
p += (IS_DIRECTORY_SEP (p[-1]) && IS_DIRECTORY_SEP (p[0])
|
||||
&& !IS_DIRECTORY_SEP (p[1]));
|
||||
#endif
|
||||
for (; p < endp; p++)
|
||||
{
|
||||
if (IS_DIRECTORY_SEP (p[-1])
|
||||
&& file_name_absolute_p (p)
|
||||
#if defined (WINDOWSNT) || defined (CYGWIN)
|
||||
/* // at start of file name is meaningful in Apollo,
|
||||
WindowsNT and Cygwin systems. */
|
||||
&& !(IS_DIRECTORY_SEP (p[0]) && p - 1 == nm)
|
||||
#endif /* not (WINDOWSNT || CYGWIN) */
|
||||
)
|
||||
if (IS_DIRECTORY_SEP (p[-1]) && file_name_absolute_p (p))
|
||||
{
|
||||
for (s = p; *s && !IS_DIRECTORY_SEP (*s); s++);
|
||||
char *s;
|
||||
for (s = p; *s && !IS_DIRECTORY_SEP (*s); s++)
|
||||
continue;
|
||||
if (p[0] == '~' && s > p + 1) /* We've got "/~something/". */
|
||||
{
|
||||
USE_SAFE_ALLOCA;
|
||||
|
|
Loading…
Add table
Reference in a new issue