- if ((p = strstr(fbuf, "..")) != NULL
- && (p[2] == '/' || p[2] == '\0')
- && (p == fbuf || p[-1] == '/')) {
- rprintf(FERROR,
- "using a \"..\" dir is invalid with --relative: %s\n",
- fbuf);
- exit_cleanup(RERR_SYNTAX);
+ for (p = fn; (p = strstr(p, "..")) != NULL; p += 2) {
+ if ((p[2] == '/' || p[2] == '\0')
+ && (p == fn || p[-1] == '/')) {
+ rprintf(FERROR,
+ "found \"..\" dir in relative path: %s\n",
+ fbuf);
+ exit_cleanup(RERR_SYNTAX);
+ }