X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;f=bacula%2Fsrc%2Fdird%2Fua_tree.c;h=7af685a6c1ec931094e150151731bba19a5715c1;hb=4e4c9c7de494925690cbb2da7518b77458bd0de3;hp=7bc68576cf807a66ce5694eec18fe7891c6d1515;hpb=47d98826c5a061954a382931f70087f70888c5eb;p=bacula%2Fbacula diff --git a/bacula/src/dird/ua_tree.c b/bacula/src/dird/ua_tree.c index 7bc68576cf..7af685a6c1 100644 --- a/bacula/src/dird/ua_tree.c +++ b/bacula/src/dird/ua_tree.c @@ -183,14 +183,21 @@ int insert_tree_handler(void *ctx, int num_fields, char **row) } else { tree->avail_node = NULL; /* added node to tree */ } - new_node->FileIndex = atoi(row[2]); - new_node->JobId = (JobId_t)str_to_int64(row[3]); - new_node->type = type; - new_node->extract = true; /* extract all by default */ - new_node->hard_link = hard_link; - new_node->soft_link = S_ISLNK(statp.st_mode) != 0; - if (type == TN_DIR || type == TN_DIR_NLS) { - new_node->extract_dir = true; /* if dir, extract it */ + /* + * If the user has backed up a hard linked file twice, the + * second copy will be a pointer (i.e. hard link will be set), + * so we do not overwrite the original file with a pointer file. + */ + if (!new_node->hard_link || hard_link) { + new_node->hard_link = hard_link; + new_node->FileIndex = atoi(row[2]); + new_node->JobId = (JobId_t)str_to_int64(row[3]); + new_node->type = type; + new_node->extract = true; /* extract all by default */ + new_node->soft_link = S_ISLNK(statp.st_mode) != 0; + if (type == TN_DIR || type == TN_DIR_NLS) { + new_node->extract_dir = true; /* if dir, extract it */ + } } tree->cnt++; return 0;