From 6a9f4fd6e2d3778a445b6eb8b275d1f02095607c Mon Sep 17 00:00:00 2001 From: dteske Date: Mon, 4 Mar 2013 01:35:56 +0000 Subject: [PATCH] MFC r230296: 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: dteske git-svn-id: svn://svn.freebsd.org/base/stable/8@247748 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f --- usr.sbin/tzsetup/tzsetup.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/usr.sbin/tzsetup/tzsetup.c b/usr.sbin/tzsetup/tzsetup.c index 17be89bb4..7c3cfb244 100644 --- a/usr.sbin/tzsetup/tzsetup.c +++ b/usr.sbin/tzsetup/tzsetup.c @@ -721,9 +721,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); -- 2.45.0