about summary refs log tree commit diff
path: root/time
diff options
context:
space:
mode:
Diffstat (limited to 'time')
-rw-r--r--time/Makefile16
-rw-r--r--time/zic.c17
2 files changed, 25 insertions, 8 deletions
diff --git a/time/Makefile b/time/Makefile
index d90bc87d42..fb9ef32535 100644
--- a/time/Makefile
+++ b/time/Makefile
@@ -37,9 +37,11 @@ routines	:= offtime asctime clock ctime ctime_r difftime	\
 others	:= ap zdump zic
 tests	:= test_time clocktest
 
-tzfiles := africa antarctica asia australasia europe northamerica \
-	   southamerica etcetera factory systemv backward \
+tzbases := africa antarctica asia australasia europe northamerica \
+	   southamerica etcetera factory systemv \
 	   solar87 solar88 solar89
+tzlinks := backward
+tzfiles := $(tzbases) $(tzlinks)
 # pacificnew doesn't compile; if it is to be used, it should be included in
 # northamerica.
 distribute += $(tzfiles) leapseconds pacificnew simplebackw
@@ -96,11 +98,21 @@ $(tzfiles:%=$(objpfx)z.%): $(objpfx)z.%: % Makefile
 # Kludge alert: we use an implicit rule (in what we are generating here)
 # because that is the only way to tell Make that the one command builds all
 # the files.
+# The extra kludge for the $(tzlinks) files is necessary since running zic
+# this file requires all other files to exist.  Blech!
 	(echo 'define $*-zones'						    ;\
 	 awk '$$1 == "Zone" { print $$2 } $$1 == "Link" { print $$3 }' $^   ;\
 	 echo 'endef'							    ;\
 	 echo '$*-zones := $$(subst $$(nl), ,$$($*-zones))'		    ;\
 	 echo 'ifdef $*-zones'						    ;\
+	 if test x$(findstring $*, $(tzlinks)) != x; then		     \
+	   echo '$$(addprefix $$(inst_datadir)/zone%/right/,$$($*-zones)) \';\
+	   echo '$$(addprefix $$(inst_datadir)/zone%/posix/,$$($*-zones)) \';\
+	   echo '$$(addprefix $$(inst_datadir)/zone%/,$$($*-zones)): \'	    ;\
+	   echo '$$(foreach t,$$(tzbases),$$(addprefix $$(inst_datadir)/zone%/right/,$$($$t-zones))) \' ;\
+	   echo '$$(foreach t,$$(tzbases),$$(addprefix $$(inst_datadir)/zone%/posix/,$$($$t-zones))) \' ;\
+	   echo '$$(foreach t,$$(tzbases),$$(addprefix $$(inst_datadir)/zone%/,$$($$t-zones)))' ;\
+	 fi								    ;\
 	 echo '$$(addprefix $$(inst_datadir)/zone%/right/,$$($*-zones)): \' ;\
 	 echo '$< $$(objpfx)zic leapseconds yearistype'			    ;\
 	 echo '	$$(tzcompile)'						    ;\
diff --git a/time/zic.c b/time/zic.c
index 9ab3967e98..2e07d79196 100644
--- a/time/zic.c
+++ b/time/zic.c
@@ -2126,15 +2126,20 @@ char * const	argname;
 		if (!itsdir(name)) {
 			/*
 			** It doesn't seem to exist, so we try to create it.
+			** Double check the return. Someone may be one
+			** step ahead of us.
 			*/
 			if (mkdir(name, 0755) != 0) {
-				const char *e = strerror(errno);
+			  	int save_error = errno;
+				if (errno == EEXIST && !itsdir(name)) {
+					const char *e = strerror(save_error);
 
-				(void) fprintf(stderr,
-				    _("%s: Can't create directory %s: %s\n"),
-				    progname, name, e);
-				ifree(name);
-				return -1;
+					(void) fprintf(stderr,
+				      _("%s: Can't create directory %s: %s\n"),
+						       progname, name, e);
+					ifree(name);
+					return -1;
+				}
 			}
 		}
 		*cp = '/';