about summary refs log tree commit diff
path: root/time
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>1998-01-30 18:05:01 +0000
committerUlrich Drepper <drepper@redhat.com>1998-01-30 18:05:01 +0000
commit70f37c4c3f2935efbf80644d6bd9a32f53a611cc (patch)
tree1b3e048a4dc8e4c17b6147d69588d10b83462062 /time
parent34fbbb38777cc0d1a0f922fdd749b5da945f2d1b (diff)
downloadglibc-70f37c4c3f2935efbf80644d6bd9a32f53a611cc.tar.gz
glibc-70f37c4c3f2935efbf80644d6bd9a32f53a611cc.tar.xz
glibc-70f37c4c3f2935efbf80644d6bd9a32f53a611cc.zip
(dolink): Use symlink if hard link failed with EXDEV.
Diffstat (limited to 'time')
-rw-r--r--time/zic.c21
1 files changed, 17 insertions, 4 deletions
diff --git a/time/zic.c b/time/zic.c
index c95887c9b4..c94c32206b 100644
--- a/time/zic.c
+++ b/time/zic.c
@@ -601,10 +601,23 @@ const char * const	tofile;
 	if (!itsdir(toname))
 		(void) remove(toname);
 	if (link(fromname, toname) != 0) {
-		if (mkdirs(toname) != 0)
-			(void) exit(EXIT_FAILURE);
-		if (link(fromname, toname) != 0) {
-			const char *e = strerror(errno);
+		int failure = errno;
+		if (failure == ENOENT)
+			if (mkdirs(toname) != 0)
+				failure = errno;
+			else if (link(fromname, toname) == 0)
+				failure = 0;
+			else
+				failure = errno;
+#ifndef MISSING_SYMLINK
+		if (failure == EXDEV)
+			if (symlink(fromname, toname) != 0)
+				failure = errno;
+			else
+				failure = 0;
+#endif
+ 		if (failure) {
+ 			const char *e = strerror(failure);
 
 			(void) fprintf(stderr,
 				_("%s: Can't link from %s to %s: %s\n"),