From 83c6cfefa695eb594b46e4e415f511e054e125c9 Mon Sep 17 00:00:00 2001 From: Ian Abbott Date: Thu, 25 Feb 2016 16:46:25 +0000 Subject: [PATCH] zic: don't warn about link creation failure if not supported When linking zone files in dolink(from, to), zic first tries to create hard links, falling back to creating symbolic links, falling back to creating copies. If HAVE_LINK is 0, link(from, to) is defined as a macro that always fails, so in that case, don't issue the warning "hard link failed, symbolic link used" when symbolic links are successfully created in place of hard links. If HAVE_SYMLINK is 0, symlink(from, to) is defined as a macro that always fails, so in that case, don't issue the warning "link failed, copy used" when copies are successfully created in place of symbolic links. Signed-off-by: Ian Abbott --- zic.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/zic.c b/zic.c index 78ab870..418224e 100644 --- a/zic.c +++ b/zic.c @@ -788,8 +788,11 @@ dolink(char const *fromfield, char const *tofield) memcpy(p, "../", 3); strcpy(p, t); result = symlink(symlinkcontents, toname); - if (result == 0) + if (result == 0) { +#if HAVE_LINK warning(_("hard link failed, symbolic link used")); +#endif + } free(symlinkcontents); } if (result != 0) { @@ -815,7 +818,9 @@ warning(_("hard link failed, symbolic link used")); putc(c, tp); close_file(fp, fromname); close_file(tp, toname); +#if HAVE_SYMLINK warning(_("link failed, copy used")); +#endif } } free(fromname); -- 2.7.0