Displaying 1 result from an estimated 1 matches for "child_len".
Did you mean:
child_end
2014 Jan 01
0
Soft chroot jail for sftp-server
...nate 2 path parts in a way that one doesn't need to care about leading/trailing slashes. Returned pointer can be freed. */
> static char* concat_path(char* parent, char* child) {
> size_t parent_len = strlen(parent);
> if (parent_len < 1)
> return xstrdup(child);
> size_t child_len = strlen(child);
> if (child_len < 1)
> return xstrdup(parent);
>
> if (*child == '/') {
> child++;
> child_len--;
> }
>
> char* cat;
> if (*(parent + parent_len - 1) == '/') {
> size_t cat_len = sizeof(char) * (parent_len + child...