mfu_param_path: fix cutting root component
* mfu_param_path: fix cutting root component
Even when `! copy_into_dir`, we still still shouldn't cut the root
component.
@@ -401,13 +401,12 @@ char* mfu_param_path_copy_dest(const char* name, int numpaths,
* if path is root, keep last component.
* otherwise cut all components listed in source path */
int cut = src_components;
- if (mfu_copy_opts->copy_into_dir && cut > 0) {
- if (strcmp(paths[i].orig, "/") == 0) {
- cut--;
- } else if ((mfu_copy_opts->do_sync != 1) &&
- (paths[i].orig[strlen(paths[i].orig) - 1] != '/')) {
+ if (cut > 0 && strcmp(paths[i].orig, "/") == 0) {
cut--;
}
+ else if ((cut > 0) && mfu_copy_opts->copy_into_dir &&
+ (mfu_copy_opts->do_sync != 1) && (paths[i].orig[strlen(paths[i].orig) - 1] != '/')) {
+ cut--;
}
/* compute number of components to keep */
