From 046e176269f94d0e304bb66cad61dc4d0fca8dbd Mon Sep 17 00:00:00 2001 From: wollman Date: Wed, 8 Feb 2012 05:03:04 +0000 Subject: [PATCH] It's not an error if unlink(2) fails because the pathname doesn't exist. Noticed by: kevlo Pointy hat to: wollman --- usr.sbin/tzsetup/tzsetup.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/usr.sbin/tzsetup/tzsetup.c b/usr.sbin/tzsetup/tzsetup.c index 5da9d7224a5d..97daa0bd51f0 100644 --- a/usr.sbin/tzsetup/tzsetup.c +++ b/usr.sbin/tzsetup/tzsetup.c @@ -723,7 +723,7 @@ install_zoneinfo_file(const char *zoneinfo_file) return (DITEM_FAILURE | DITEM_RECREATE); } - if (unlink(path_localtime) < 0) { + if (unlink(path_localtime) < 0 && errno != ENOENT) { snprintf(prompt, sizeof(prompt), "Could not unlink %s: %s", path_localtime, strerror(errno)); @@ -780,7 +780,7 @@ install_zoneinfo_file(const char *zoneinfo_file) fprintf(stderr, "%s\n", prompt); return (DITEM_FAILURE | DITEM_RECREATE); } - if (unlink(path_localtime) < 0) { + if (unlink(path_localtime) < 0 && errno != ENOENT) { snprintf(prompt, sizeof(prompt), "Could not unlink %s: %s", path_localtime, strerror(errno));