Skip to content

Commit

Permalink
minor fix about archive extract existsing symlink
Browse files Browse the repository at this point in the history
  • Loading branch information
sulincix committed May 31, 2024
1 parent 0236c9b commit 570eb26
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/ccode/archive-extract.c
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,8 @@ void archive_create(archive *data){
extern char* sdirname(char* path);
extern void create_dir(char* path);
extern bool isdir(char* path);
extern bool issymlink(char* path);
extern bool isfile(char* path);
static void archive_extract_fn(archive *data, char *path, bool all) {
fdebug("archive extract: %s => %s", data->archive_path, path);
archive_load_archive(data);
Expand Down Expand Up @@ -119,6 +121,9 @@ static void archive_extract_fn(archive *data, char *path, bool all) {
if (!isdir(dirname)) {
create_dir(dirname);
}
if(issymlink(target_file) || isfile(target_file)){
unlink(target_file);
}
if (S_ISLNK(mode)) {
char *link_target = archive_entry_symlink(entry);
if (link_target != NULL) {
Expand Down

0 comments on commit 570eb26

Please sign in to comment.