summaryrefslogtreecommitdiffstats
path: root/usr.sbin
diff options
context:
space:
mode:
authoremaste <emaste@FreeBSD.org>2012-01-18 04:12:32 +0000
committeremaste <emaste@FreeBSD.org>2012-01-18 04:12:32 +0000
commitb955b33d3ab6152aae4d966a3dd5d954c90f57c8 (patch)
tree5d3c8b1805b90a95eb05c9d11e4c6ca2e073e9ce /usr.sbin
parent623ee56937b7b5667a6079f6c1bb83c2ed2ecbbc (diff)
downloadFreeBSD-src-b955b33d3ab6152aae4d966a3dd5d954c90f57c8.zip
FreeBSD-src-b955b33d3ab6152aae4d966a3dd5d954c90f57c8.tar.gz
Don't write /var/db/zoneinfo when zone is not actually changed.
If the specified zone file does not exist or the -n flag is specified, do not update /var/db/zoneinfo. PR: bin/164039 Submitted by: Devin Teske <dteske vicor com> MFC after: 1 week
Diffstat (limited to 'usr.sbin')
-rw-r--r--usr.sbin/tzsetup/tzsetup.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/usr.sbin/tzsetup/tzsetup.c b/usr.sbin/tzsetup/tzsetup.c
index 52824cd..d68ded3 100644
--- a/usr.sbin/tzsetup/tzsetup.c
+++ b/usr.sbin/tzsetup/tzsetup.c
@@ -829,9 +829,11 @@ install_zoneinfo(const char *zoneinfo)
rv = install_zoneinfo_file(path_zoneinfo_file);
/* Save knowledge for later */
- if ((f = fopen(path_db, "w")) != NULL) {
- fprintf(f, "%s\n", zoneinfo);
- fclose(f);
+ if (reallydoit && (rv & DITEM_FAILURE) == 0) {
+ if ((f = fopen(path_db, "w")) != NULL) {
+ fprintf(f, "%s\n", zoneinfo);
+ fclose(f);
+ }
}
return (rv);
OpenPOWER on IntegriCloud