svn commit: r299589 - head/usr.bin/catman

Don Lewis truckman at FreeBSD.org
Fri May 13 05:49:03 UTC 2016


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));


More information about the svn-src-head mailing list