diff options
author | emaste <emaste@FreeBSD.org> | 2012-01-18 04:12:32 +0000 |
---|---|---|
committer | emaste <emaste@FreeBSD.org> | 2012-01-18 04:12:32 +0000 |
commit | b955b33d3ab6152aae4d966a3dd5d954c90f57c8 (patch) | |
tree | 5d3c8b1805b90a95eb05c9d11e4c6ca2e073e9ce /usr.sbin/tzsetup | |
parent | 623ee56937b7b5667a6079f6c1bb83c2ed2ecbbc (diff) | |
download | FreeBSD-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/tzsetup')
-rw-r--r-- | usr.sbin/tzsetup/tzsetup.c | 8 |
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); |