Mercurial > hg > octave-lyh > gnulib-hg
changeset 16352:c6d7d4c82b13
canonicalize-lgpl: fix // handling
Same as the previous patch, for the lgpl version.
* lib/canonicalize-lgpl.c (__realpath): Don't convert /// to //.
Signed-off-by: Eric Blake <eblake@redhat.com>
author | Eric Blake <eblake@redhat.com> |
---|---|
date | Sat, 04 Feb 2012 10:03:29 -0700 |
parents | b6d4d01caa2b |
children | 8b572983af73 |
files | ChangeLog lib/canonicalize-lgpl.c |
diffstat | 2 files changed, 10 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,8 @@ 2012-02-04 Eric Blake <eblake@redhat.com> + canonicalize-lgpl: fix // handling + * lib/canonicalize-lgpl.c (__realpath): Don't convert /// to //. + canonicalize: fix // handling * lib/canonicalize.c (canonicalize_filename_mode): Don't convert /// to //, since only // is special.
--- a/lib/canonicalize-lgpl.c +++ b/lib/canonicalize-lgpl.c @@ -156,7 +156,7 @@ { rpath[0] = '/'; dest = rpath + 1; - if (DOUBLE_SLASH_IS_DISTINCT_ROOT && name[1] == '/') + if (DOUBLE_SLASH_IS_DISTINCT_ROOT && name[1] == '/' && name[2] != '/') *dest++ = '/'; } @@ -187,7 +187,7 @@ if (dest > rpath + 1) while ((--dest)[-1] != '/'); if (DOUBLE_SLASH_IS_DISTINCT_ROOT && dest == rpath + 1 - && *dest == '/') + && *dest == '/' && dest[1] != '/') dest++; } else @@ -298,7 +298,8 @@ if (buf[0] == '/') { dest = rpath + 1; /* It's an absolute symlink */ - if (DOUBLE_SLASH_IS_DISTINCT_ROOT && buf[1] == '/') + if (DOUBLE_SLASH_IS_DISTINCT_ROOT + && buf[1] == '/' && buf[2] != '/') *dest++ = '/'; } else @@ -308,7 +309,7 @@ if (dest > rpath + 1) while ((--dest)[-1] != '/'); if (DOUBLE_SLASH_IS_DISTINCT_ROOT && dest == rpath + 1 - && *dest == '/') + && *dest == '/' && dest[1] != '/') dest++; } } @@ -321,7 +322,8 @@ } if (dest > rpath + 1 && dest[-1] == '/') --dest; - if (DOUBLE_SLASH_IS_DISTINCT_ROOT && dest == rpath + 1 && *dest == '/') + if (DOUBLE_SLASH_IS_DISTINCT_ROOT && dest == rpath + 1 + && *dest == '/' && dest[1] != '/') dest++; *dest = '\0';