File tzcode-symlink.patch of Package timezone

--- timezone-2013g/zic.c
+++ timezone-2013g/zic.c	2013-10-14 14:23:08.450235811 +0000
@@ -120,7 +120,7 @@ static int	addtype(zic_t gmtoff, const c
 static void	leapadd(zic_t t, int positive, int rolling, int count);
 static void	adjleap(void);
 static void	associate(void);
-static void	dolink(const char * fromfield, const char * tofield);
+static void	dolink(const char * fromfield, const char * tofield, int defaultsymlink);
 static char **	getfields(char * buf);
 static zic_t	gethms(const char * string, const char * errstrng,
 		       int signable);
@@ -575,7 +575,7 @@ _("%s: More than one -L option specified
 	*/
 	for (i = 0; i < nlinks; ++i) {
 		eat(links[i].l_filename, links[i].l_linenum);
-		dolink(links[i].l_from, links[i].l_to);
+		dolink(links[i].l_from, links[i].l_to, FALSE);
 		if (noise)
 			for (j = 0; j < nlinks; ++j)
 				if (strcmp(links[i].l_to,
@@ -584,18 +584,19 @@ _("%s: More than one -L option specified
 	}
 	if (lcltime != NULL) {
 		eat("command line", 1);
-		dolink(lcltime, TZDEFAULT);
+		dolink(lcltime, TZDEFAULT, TRUE);
 	}
 	if (psxrules != NULL) {
 		eat("command line", 1);
-		dolink(psxrules, TZDEFRULES);
+		dolink(psxrules, TZDEFRULES, FALSE);
 	}
 	return (errors == 0) ? EXIT_SUCCESS : EXIT_FAILURE;
 }
 
 static void
-dolink(const char *const fromfield, const char *const tofield)
+dolink(const char *const fromfield, const char *const tofield, int defaultsymlink)
 {
+	struct stat st;
 	register char *	fromname;
 	register char *	toname;
 
@@ -606,6 +607,10 @@ dolink(const char *const fromfield, cons
 		fromname = ecatalloc(fromname, "/");
 		fromname = ecatalloc(fromname, fromfield);
 	}
+
+	if (lstat(fromname, &st) == 0 && S_ISLNK(st.st_mode))
+		defaultsymlink = TRUE;
+
 	if (tofield[0] == '/')
 		toname = ecpyalloc(tofield);
 	else {
@@ -619,15 +624,16 @@ dolink(const char *const fromfield, cons
 	*/
 	if (!itsdir(toname))
 		(void) remove(toname);
-	if (link(fromname, toname) != 0
+	if (defaultsymlink || link(fromname, toname) != 0
 	    && access(fromname, F_OK) == 0 && !itsdir(fromname)) {
 		int	result;
 
 		if (mkdirs(toname) != 0)
 			exit(EXIT_FAILURE);
 
-		result = link(fromname, toname);
-		if (result != 0) {
+		if (!defaultsymlink) result = link(fromname, toname);
+
+		if ((defaultsymlink || (!defaultsymlink && result != 0))) {
 				const char *s = fromname;
 				const char *t;
 				register char * symlinkcontents = NULL;
openSUSE Build Service is sponsored by