| 3518 | } |
| 3519 | |
| 3520 | int remove_path(const char *name) |
| 3521 | { |
| 3522 | const char *last; |
| 3523 | |
| 3524 | if (unlink(name) && !is_missing_file_error(errno)) |
| 3525 | return -1; |
| 3526 | |
| 3527 | last = strrchr(name, '/'); |
| 3528 | if (last) { |
| 3529 | char *dirs = xstrdup(name); |
| 3530 | char *slash = dirs + (last - name); |
| 3531 | do { |
| 3532 | *slash = '\0'; |
| 3533 | if (startup_info->original_cwd && |
| 3534 | !strcmp(startup_info->original_cwd, dirs)) |
| 3535 | break; |
| 3536 | } while (rmdir(dirs) == 0 && (slash = strrchr(dirs, '/'))); |
| 3537 | free(dirs); |
| 3538 | } |
| 3539 | return 0; |
| 3540 | } |
| 3541 | |
| 3542 | /* |
| 3543 | * Frees memory within dir which was allocated, and resets fields for further |
no test coverage detected