while (ret == SCLD_OK && next_component) {
struct stat st;
- char *slash = strchr(next_component, '/');
+ char *slash = next_component, slash_character;
- if (!slash)
+ while (*slash && !is_dir_sep(*slash))
+ slash++;
+
+ if (!*slash)
break;
next_component = slash + 1;
- while (*next_component == '/')
+ while (is_dir_sep(*next_component))
next_component++;
if (!*next_component)
break;
+ slash_character = *slash;
*slash = '\0';
if (!stat(path, &st)) {
/* path exists */
} else if (adjust_shared_perm(path)) {
ret = SCLD_PERMS;
}
- *slash = '/';
+ *slash = slash_character;
}
return ret;
}