If hardlink exists, remove it before attempting to recreate it
This commit is contained in:
parent
0132e493e4
commit
a988a7877e
1 changed files with 3 additions and 1 deletions
4
haggis.c
4
haggis.c
|
@ -832,6 +832,8 @@ int haggis_extract_hardlink(haggis_node *node, char *basedir) {
|
||||||
}
|
}
|
||||||
fclose(fd);
|
fclose(fd);
|
||||||
}
|
}
|
||||||
|
if (access(path, F_OK) == 0)
|
||||||
|
unlink(path);
|
||||||
ret = link(target, path);
|
ret = link(target, path);
|
||||||
free(path);
|
free(path);
|
||||||
free(target);
|
free(target);
|
||||||
|
@ -888,7 +890,7 @@ char* haggis_extract_file(haggis_node *node, char *basedir) {
|
||||||
int haggis_extract_node(char *basedir, haggis_node *node, haggis_mq *mq) {
|
int haggis_extract_node(char *basedir, haggis_node *node, haggis_mq *mq) {
|
||||||
haggis_msg *msg;
|
haggis_msg *msg;
|
||||||
char *path, *dir, *fullpath;
|
char *path, *dir, *fullpath;
|
||||||
int ret;
|
int ret = 0;
|
||||||
|
|
||||||
path = get_full_path(&node->name, basedir);
|
path = get_full_path(&node->name, basedir);
|
||||||
dir = dirname(strndup(path, PATH_MAX));
|
dir = dirname(strndup(path, PATH_MAX));
|
||||||
|
|
Loading…
Add table
Reference in a new issue