rem: } else if ((*p == '.') && (*(p+1) == '.') &&
add: continue; } allowdotdot = 0; if ((*p == '.') && (*(p+1) == '.') &&
context: void sanitize_path(char *p){	char *start, *sanp;	start = p;	sanp = p;	while (*p == '/') {		/* remove leading slashes */		p++;	}	while (*p != '\0') {		/* this loop iterates once per filename component in p.		 * both p (and sanp if the original had a slash) should		 * always be left pointing after a slash		 */		if ((*p == '.') && ((*(p+1) == '/') || (*(p+1) == '\0'))) {			/* skip "." component */			while (*++p == '/') {				/* skip following slashes */				;			}		} else if ((*p == '.') && (*(p+1) == '.') &&			    ((*(p+2) == '/') || (*(p+2) == '\0'))) {			/* skip ".." component followed by slash or end */			p += 2;			if (*p == '/')				p++;			if (sanp != start) {				/* back up sanp one level */				--sanp; /* now pointing at slash */				while ((sanp > start) && (*(sanp - 1) != '/')) {					/* skip back up to slash */					sanp--;				}			}		} else {			while (1) {				/* copy one component through next slash */				*sanp++ = *p++;				if ((*p == '\0') || (*(p-1) == '/')) {					while (*p == '/') {						/* skip multiple slashes */						p++;					}					break;				}			}		}	}	if (sanp == start) {		/* ended up with nothing, so put in "." component */		*sanp++ = '.';	}	*sanp = '\0';}