diff options
author | Yu A Wang <yu.a.wang@intel.com> | 2011-07-08 19:15:37 +0200 |
---|---|---|
committer | Samuel Ortiz <sameo@linux.intel.com> | 2011-07-08 19:21:08 +0200 |
commit | 6dda6a178850306813bcb2b16b7f3303e2603c0b (patch) | |
tree | ae5723c76823714e1e59a004d99a337efb330e1a /src/timezone.c | |
parent | cb53c7f9d140dd6270b4d72b61990579cb2f7153 (diff) | |
download | connman-6dda6a178850306813bcb2b16b7f3303e2603c0b.tar.gz connman-6dda6a178850306813bcb2b16b7f3303e2603c0b.tar.bz2 connman-6dda6a178850306813bcb2b16b7f3303e2603c0b.zip |
timezone: Remove /etc/localtime if it's a symbolic link
And copy the timezone file over.
Fixes BMC #18887
Diffstat (limited to 'src/timezone.c')
-rw-r--r-- | src/timezone.c | 6 |
1 files changed, 6 insertions, 0 deletions
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; |