Author: emaste
Date: Wed Jan 18 04:12:32 2012
New Revision: 230296
URL: http://svn.freebsd.org/changeset/base/230296

Log:
  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

Modified:
  head/usr.sbin/tzsetup/tzsetup.c

Modified: head/usr.sbin/tzsetup/tzsetup.c
==============================================================================
--- head/usr.sbin/tzsetup/tzsetup.c     Wed Jan 18 03:07:34 2012        
(r230295)
+++ head/usr.sbin/tzsetup/tzsetup.c     Wed Jan 18 04:12:32 2012        
(r230296)
@@ -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);
_______________________________________________
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to