From ed6572ee0b680e52869a487f5ed537b97e666d2c Mon Sep 17 00:00:00 2001 From: dougb Date: Sun, 6 Nov 2011 07:43:57 +0000 Subject: [PATCH] MFC 227011: If the user is moving from any other time zone to UTC we need to delete any old /var/db/zoneinfo file that may exist so that tzsetup -r does the right thing. git-svn-id: svn://svn.freebsd.org/base/stable/8@227144 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f --- usr.sbin/tzsetup/tzsetup.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/usr.sbin/tzsetup/tzsetup.c b/usr.sbin/tzsetup/tzsetup.c index 825147053..5a9ea0a6e 100644 --- a/usr.sbin/tzsetup/tzsetup.c +++ b/usr.sbin/tzsetup/tzsetup.c @@ -565,6 +565,18 @@ install_zoneinfo_file(const char *zoneinfo_file) return (DITEM_FAILURE | DITEM_RECREATE); } + if (unlink(path_db) < 0 && errno != ENOENT) { + snprintf(title, sizeof(title), "Error"); + snprintf(prompt, sizeof(prompt), + "Could not delete %s: %s", path_db, + strerror(errno)); + if (usedialog) + dialog_mesgbox(title, prompt, 8, 72); + else + fprintf(stderr, "%s\n", prompt); + + return (DITEM_FAILURE | DITEM_RECREATE); + } return (DITEM_LEAVE_MENU); } -- 2.45.0