diff options
Diffstat (limited to 'timezone')
-rw-r--r-- | timezone/zic.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/timezone/zic.c b/timezone/zic.c index e5c6761..296f284c 100644 --- a/timezone/zic.c +++ b/timezone/zic.c @@ -621,6 +621,16 @@ const char * const tofile; symlinkcontents = ecatalloc(symlinkcontents, "../"); symlinkcontents = ecatalloc(symlinkcontents, fromname); + result = unlink(toname); + if (result != 0 && errno != ENOENT) { + const char *e = strerror(errno); + + (void) fprintf(stderr, + _("%s: Can't unlink %s: %s\n"), + progname, toname, e); + (void) exit(EXIT_FAILURE); + } + result = symlink(symlinkcontents, toname); if (result == 0) warning(_("hard link failed, symbolic link used")); |