From b955b33d3ab6152aae4d966a3dd5d954c90f57c8 Mon Sep 17 00:00:00 2001 From: emaste Date: Wed, 18 Jan 2012 04:12:32 +0000 Subject: 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 MFC after: 1 week --- usr.sbin/tzsetup/tzsetup.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'usr.sbin') 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); -- cgit v1.1