Instead of ignoring the EEXIST from link(), unconditionally unlink

the terget before calling link().  This should prevent links to an
old copy of the file from being retained.
This commit is contained in:
Don Lewis 2016-05-13 05:49:02 +00:00
parent aa60f7a6de
commit e4efa066e1
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=299589

View File

@ -422,9 +422,11 @@ process_page(char *mandir, char *src, char *cat, enum Ziptype zipped)
fprintf(stderr, "%slink %s -> %s\n",
verbose ? "\t" : "", cat, link_name);
}
if (!pretend)
if (link(link_name, cat) < 0 && errno != EEXIST)
if (!pretend) {
(void) unlink(cat);
if (link(link_name, cat) < 0)
warn("%s %s: link", link_name, cat);
}
return;
}
insert_hashtable(links, src_ino, src_dev, strdup(cat));