libc/413: "zic -l" fails (cross-device link)

Zack Weinberg zack at rabi.phys.columbia.edu
Sun Jan 18 21:45:03 UTC 1998


The appended patch should fix the problem you reported.  I am not certain
that this fix is the right one, and am cc:ing the tz maintainers for
comments.

zw

Sun Jan 18 16:37:02 1998  Zack Weinberg  <zack at rabi.phys.columbia.edu>

	* time/zic.c (dolink): Try symlink() if link() fails with
	EXDEV.

--- zic.c.old	Sun Jan 18 16:27:39 1998
+++ zic.c	Sun Jan 18 16:36:29 1998
@@ -600,10 +600,10 @@
 	*/
 	if (!itsdir(toname))
 		(void) remove(toname);
+	if (mkdirs(toname) != 0)
+		(void) exit(EXIT_FAILURE);
 	if (link(fromname, toname) != 0) {
-		if (mkdirs(toname) != 0)
-			(void) exit(EXIT_FAILURE);
-		if (link(fromname, toname) != 0) {
+		if (errno != EXDEV || symlink(fromname, toname) != 0) {
 			const char *e = strerror(errno);
 
 			(void) fprintf(stderr,



More information about the tz mailing list