Browse Source

fl_wrapper: fix sort_of_realpath (which could not handle multiple consecutive slashes)

user/amery/test/random-cleanup
Juergen "George" Sawinski 18 years ago
committed by Alejandro Mery
parent
commit
d6f22dfb2a
1 changed files with 7 additions and 3 deletions
  1. +7
    -3
      src/tools-source/fl_wrapper/fl_wrapper.c

+ 7
- 3
src/tools-source/fl_wrapper/fl_wrapper.c

@ -3,7 +3,7 @@
* This copyright note is auto-generated by ./scripts/Create-CopyPatch.
*
* Filename: src/tools-source/fl_wrapper/fl_wrapper.c
* Copyright (C) 2006 - 2009 The OpenSDE Project
* Copyright (C) 2006 - 2010 The OpenSDE Project
* Copyright (C) 2004 - 2006 The T2 SDE Project
* Copyright (C) 1998 - 2003 Clifford Wolf
*
@ -279,18 +279,22 @@ static void sort_of_realpath (const char *file, char *absfile)
}
const char* src = file; char* dst = absfile;
/* till the end, remove ./ and ../ parts */
/* till the end, remove //, ./ and ../ parts */
while (dst < absfile + PATH_MAX && *src) {
if (*src == '.') {
if (*src == '/' && src[1] == '/')
while (src[1] == '/') src++;
else if (*src == '.') {
if (src[1] == '.' && (src[2] == '/' || src[2] == 0)) {
if (dst > absfile+1) --dst; /* jump to last '/' */
while (dst >absfile+1 && dst[-1] != '/')
--dst;
src += 2; if (*src) src++;
while (*src == '/') src++;
continue;
}
else if (src[1] == '/' || src[1] == 0) {
src += 1; if (*src) src++;
while (*src == '/') src++;
continue;
}
}

Loading…
Cancel
Save