summaryrefslogtreecommitdiffstats
path: root/usr.sbin
diff options
context:
space:
mode:
authordougb <dougb@FreeBSD.org>2011-11-02 04:21:20 +0000
committerdougb <dougb@FreeBSD.org>2011-11-02 04:21:20 +0000
commit1c4c4e955ecb312fef7bda58d15d4a6314d6fd40 (patch)
tree940935f857171d76c751eb736a34dc5ffc6363c2 /usr.sbin
parent98d097d322e20dc1dbe956e9512aeedaa90f876d (diff)
downloadFreeBSD-src-1c4c4e955ecb312fef7bda58d15d4a6314d6fd40.zip
FreeBSD-src-1c4c4e955ecb312fef7bda58d15d4a6314d6fd40.tar.gz
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.
Diffstat (limited to 'usr.sbin')
-rw-r--r--usr.sbin/tzsetup/tzsetup.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/usr.sbin/tzsetup/tzsetup.c b/usr.sbin/tzsetup/tzsetup.c
index 8251470..5a9ea0a 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);
}
OpenPOWER on IntegriCloud