2014-09-03 22:09:53 +02:00
|
|
|
This patch is used on openSUSE versions older than 12.2.
|
|
|
|
Back then, /etc/localtime was either a hard link to a zone
|
|
|
|
file in /usr/share/zoneinfo or a copy of it.
|
|
|
|
|
|
|
|
By default, zic tries the following approaches to create
|
|
|
|
/etc/localtime:
|
|
|
|
|
|
|
|
1. Hard link
|
|
|
|
2. Symbolic link
|
|
|
|
3. File copy
|
|
|
|
|
|
|
|
This patch changes the order to:
|
|
|
|
|
|
|
|
1. Hard link
|
|
|
|
2. File copy
|
|
|
|
3. Symbolic link
|
|
|
|
|
|
|
|
Index: timezone-2014g/zic.c
|
2012-10-27 18:49:53 +02:00
|
|
|
===================================================================
|
2014-09-03 22:09:53 +02:00
|
|
|
--- timezone-2014g.orig/zic.c
|
|
|
|
+++ timezone-2014g/zic.c
|
|
|
|
@@ -686,6 +686,23 @@ namecheck(const char *name)
|
|
|
|
componentcheck(name, component, cp);
|
2010-09-21 18:21:55 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
+static int
|
|
|
|
+copy(fromname, toname)
|
|
|
|
+const char * const fromname;
|
|
|
|
+const char * const toname;
|
|
|
|
+{
|
|
|
|
+ if (!fork()) {
|
|
|
|
+ execl("/bin/cp", "cp", fromname, toname, (char*) NULL);
|
|
|
|
+ _exit(1);
|
|
|
|
+ }
|
|
|
|
+ int s;
|
|
|
|
+ if (wait(&s) < 0)
|
|
|
|
+ return -1;
|
|
|
|
+ if (!WIFEXITED(s))
|
|
|
|
+ return -1;
|
|
|
|
+ return -WEXITSTATUS(s);
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
static void
|
2012-10-27 18:49:53 +02:00
|
|
|
dolink(const char *const fromfield, const char *const tofield)
|
|
|
|
{
|
2014-09-03 22:09:53 +02:00
|
|
|
@@ -728,6 +745,8 @@ dolink(const char *const fromfield, cons
|
2010-09-21 18:21:55 +02:00
|
|
|
exit(EXIT_FAILURE);
|
|
|
|
|
|
|
|
result = link(fromname, toname);
|
|
|
|
+ if (result != 0)
|
|
|
|
+ result = copy(fromname, toname);
|
2013-10-04 12:00:42 +02:00
|
|
|
if (result != 0) {
|
2013-10-14 16:25:26 +02:00
|
|
|
const char *s = fromname;
|
2013-10-04 12:00:42 +02:00
|
|
|
const char *t;
|