From 6dda6a178850306813bcb2b16b7f3303e2603c0b Mon Sep 17 00:00:00 2001 From: Yu A Wang Date: Fri, 8 Jul 2011 19:15:37 +0200 Subject: timezone: Remove /etc/localtime if it's a symbolic link And copy the timezone file over. Fixes BMC #18887 --- src/timezone.c | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src/timezone.c') diff --git a/src/timezone.c b/src/timezone.c index c6d8d68e..08f904f5 100644 --- a/src/timezone.c +++ b/src/timezone.c @@ -271,11 +271,17 @@ done: static int write_file(void *src_map, struct stat *src_st, const char *pathname) { + struct stat st; int fd; ssize_t written; DBG("pathname %s", pathname); + if (lstat(pathname, &st) == 0) { + if (S_ISLNK(st.st_mode)) + unlink(pathname); + } + fd = open(pathname, O_WRONLY | O_CREAT | O_TRUNC, 0644); if (fd < 0) return -EIO; -- cgit v1.2.3