Date: Fri, 13 May 2016 05:49:02 +0000 (UTC) From: Don Lewis <truckman@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r299589 - head/usr.bin/catman Message-ID: <201605130549.u4D5n2Us012745@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: truckman Date: Fri May 13 05:49:02 2016 New Revision: 299589 URL: https://svnweb.freebsd.org/changeset/base/299589 Log: 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. Modified: head/usr.bin/catman/catman.c Modified: head/usr.bin/catman/catman.c ============================================================================== --- head/usr.bin/catman/catman.c Fri May 13 05:39:29 2016 (r299588) +++ head/usr.bin/catman/catman.c Fri May 13 05:49:02 2016 (r299589) @@ -422,9 +422,11 @@ process_page(char *mandir, char *src, ch 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));
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201605130549.u4D5n2Us012745>