[Bruce Evans: fix for zic following obsolete links]

Garrett Wollman wollman at lcs.mit.edu
Fri Dec 13 15:47:47 UTC 1996


Patch from a FreeBSD contributor...

-GAWollman

------- start of forwarded message (RFC 934 encapsulation) -------
Message-Id: <199612131138.WAA30698 at godzilla.zeta.org.au>
From: Bruce Evans <bde at zeta.org.au>
To: wollman at freebsd.org
Subject: fix for zic following obsolete links
Date: Fri, 13 Dec 1996 22:38:49 +1100

zic made a mess of my /usr/share/zoneinfo by not snapping obsolete links
(mostly in America/Indiana and Etc).

Bruce

diff -c2 src/usr.sbin/zic/zic.c~ src/usr.sbin/zic/zic.c
*** src/usr.sbin/zic/zic.c~	Fri Jul 19 10:27:13 1996
- --- src/usr.sbin/zic/zic.c	Thu Dec 12 21:22:16 1996
***************
*** 1424,1427 ****
- --- 1424,1438 ----
  		(int) (strlen(directory) + 1 + strlen(name) + 1));
  	(void) sprintf(fullname, "%s/%s", directory, name);
+ 
+ 	/*
+ 	 * Remove old file, if any, to snap links.
+ 	 */
+ 	if (!itsdir(fullname) && remove(fullname) != 0 && errno != ENOENT) {
+ 		const char *e = strerror(errno);
+ 		(void) fprintf(stderr, _("%s: Can't remove %s: %s\n"),
+ 			progname, fullname, e);
+ 		(void) exit(EXIT_FAILURE);
+ 	}
+ 
  	if ((fp = fopen(fullname, "wb")) == NULL) {
  		if (mkdirs(fullname) != 0)
------- end -------



More information about the tz mailing list