If hardlink exists, remove it before attempting to recreate it

This commit is contained in:
Nathan Fisher 2023-12-19 06:59:57 -05:00
parent 0132e493e4
commit a988a7877e

View file

@ -832,6 +832,8 @@ int haggis_extract_hardlink(haggis_node *node, char *basedir) {
}
fclose(fd);
}
if (access(path, F_OK) == 0)
unlink(path);
ret = link(target, path);
free(path);
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) {
haggis_msg *msg;
char *path, *dir, *fullpath;
int ret;
int ret = 0;
path = get_full_path(&node->name, basedir);
dir = dirname(strndup(path, PATH_MAX));