oldBaseDir should always be shorter than directory.... I htink the strncmp would return false if it were not, so no reason for an extra check. Checking for / is probably a good idea though.