diff --git a/usr.sbin/tzsetup/tzsetup.c b/usr.sbin/tzsetup/tzsetup.c --- a/usr.sbin/tzsetup/tzsetup.c +++ b/usr.sbin/tzsetup/tzsetup.c @@ -794,19 +794,20 @@ FILE *f; char path_zoneinfo_file[MAXPATHLEN]; - if ((size_t)snprintf(path_zoneinfo_file, sizeof(path_zoneinfo_file), - "%s/%s", path_zoneinfo, zoneinfo) >= sizeof(path_zoneinfo_file)) - errx(1, "%s/%s name too long", path_zoneinfo, zoneinfo); - rv = install_zoneinfo_file(path_zoneinfo_file); - /* Save knowledge for later */ - if (reallydoit && (rv & DITEM_FAILURE) == 0) { + if (reallydoit) { if ((f = fopen(path_db, "w")) != NULL) { fprintf(f, "%s\n", zoneinfo); fclose(f); } } + /* Install the symlink */ + if ((size_t)snprintf(path_zoneinfo_file, sizeof(path_zoneinfo_file), + "%s/%s", path_zoneinfo, zoneinfo) >= sizeof(path_zoneinfo_file)) + errx(1, "%s/%s name too long", path_zoneinfo, zoneinfo); + rv = install_zoneinfo_file(path_zoneinfo_file); + return (rv); }