From 4e720dd60d95bee7af035604010c054ec1b2dc7a Mon Sep 17 00:00:00 2001 From: Ulrich Drepper Date: Sun, 2 May 1999 11:05:14 +0000 Subject: Update. 1999-05-02 H.J. Lu * timezone/zic.c (dolink): Remove the symlink destination first. * catgets/open_catalog.c (__open_catalog): Set catalog->status to "nonexisting" if failed to open the file. --- ChangeLog | 7 +++++++ catgets/open_catalog.c | 5 ++++- timezone/zic.c | 10 ++++++++++ 3 files changed, 21 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index c1bcefe440..8f711200c9 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +1999-05-02 H.J. Lu + + * timezone/zic.c (dolink): Remove the symlink destination first. + + * catgets/open_catalog.c (__open_catalog): Set catalog->status + to "nonexisting" if failed to open the file. + 1999-05-01 Ulrich Drepper * string/bits/string2.h: Only use __builtin_memset for egcs 1.1 and diff --git a/catgets/open_catalog.c b/catgets/open_catalog.c index 4b619e49e9..aefa34f3fa 100644 --- a/catgets/open_catalog.c +++ b/catgets/open_catalog.c @@ -183,7 +183,10 @@ __open_catalog (__nl_catd catalog) /* Avoid dealing with directories and block devices */ if (fd < 0) - goto unlock_return; + { + catalog->status = nonexisting; + goto unlock_return; + } if (__fxstat (_STAT_VER, fd, &st) < 0) { diff --git a/timezone/zic.c b/timezone/zic.c index e5c6761d1e..296f284c2a 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")); -- cgit 1.4.1