From owner-svn-src-all@freebsd.org Tue Aug 1 21:41:15 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8C4AADBDE72; Tue, 1 Aug 2017 21:41:15 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 66AAB6A2FE; Tue, 1 Aug 2017 21:41:15 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v71LfEhD054014; Tue, 1 Aug 2017 21:41:14 GMT (envelope-from marius@FreeBSD.org) Received: (from marius@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v71LfExB054013; Tue, 1 Aug 2017 21:41:14 GMT (envelope-from marius@FreeBSD.org) Message-Id: <201708012141.v71LfExB054013@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: marius set sender to marius@FreeBSD.org using -f From: Marius Strobl Date: Tue, 1 Aug 2017 21:41:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r321895 - stable/10/usr.sbin/tzsetup X-SVN-Group: stable-10 X-SVN-Commit-Author: marius X-SVN-Commit-Paths: stable/10/usr.sbin/tzsetup X-SVN-Commit-Revision: 321895 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 01 Aug 2017 21:41:15 -0000 Author: marius Date: Tue Aug 1 21:41:14 2017 New Revision: 321895 URL: https://svnweb.freebsd.org/changeset/base/321895 Log: MFC: r281733, r298033, r301131 - Remove set but unused variable. - Use NULL instead of 0 for pointers. - Fix tzsetup not installing /etc/localtime for UTC. Modified: stable/10/usr.sbin/tzsetup/tzsetup.c Directory Properties: stable/10/ (props changed) Modified: stable/10/usr.sbin/tzsetup/tzsetup.c ============================================================================== --- stable/10/usr.sbin/tzsetup/tzsetup.c Tue Aug 1 20:28:11 2017 (r321894) +++ stable/10/usr.sbin/tzsetup/tzsetup.c Tue Aug 1 21:41:14 2017 (r321895) @@ -198,6 +198,7 @@ static char *chrootenv = NULL; static void usage(void); static int confirm_zone(const char *filename); static int continent_country_menu(dialogMenuItem *); +static int install_zoneinfo(const char *zoneinfo); static int install_zoneinfo_file(const char *zoneinfo_file); static int set_zone_multi(dialogMenuItem *); static int set_zone_whole_country(dialogMenuItem *); @@ -343,7 +344,7 @@ read_iso3166_table(void) err(1, "%s", path_iso3166); lineno = 0; - while ((s = fgetln(fp, &len)) != 0) { + while ((s = fgetln(fp, &len)) != NULL) { lineno++; if (s[len - 1] != '\n') errx(1, "%s:%d: invalid format", path_iso3166, lineno); @@ -353,7 +354,7 @@ read_iso3166_table(void) /* Isolate the two-letter code. */ t = strsep(&s, "\t"); - if (t == 0 || strlen(t) != 2) + if (t == NULL || strlen(t) != 2) errx(1, "%s:%d: invalid format", path_iso3166, lineno); if (t[0] < 'A' || t[0] > 'Z' || t[1] < 'A' || t[1] > 'Z') errx(1, "%s:%d: invalid code `%s'", path_iso3166, @@ -361,10 +362,10 @@ read_iso3166_table(void) /* Now skip past the three-letter and numeric codes. */ name = strsep(&s, "\t"); /* 3-let */ - if (name == 0 || strlen(name) != 3) + if (name == NULL || strlen(name) != 3) errx(1, "%s:%d: invalid format", path_iso3166, lineno); name = strsep(&s, "\t"); /* numeric */ - if (name == 0 || strlen(name) != 3) + if (name == NULL || strlen(name) != 3) errx(1, "%s:%d: invalid format", path_iso3166, lineno); name = s; @@ -406,7 +407,7 @@ add_zone_to_country(int lineno, const char *tlc, const path_zonetab, lineno); zp = malloc(sizeof(*zp)); - if (zp == 0) + if (zp == NULL) errx(1, "malloc(%zu)", sizeof(*zp)); if (cp->nzones == 0) @@ -474,7 +475,7 @@ read_zones(void) FILE *fp; struct continent *cont; size_t len; - char *line, *tlc, *coord, *file, *descr, *p; + char *line, *tlc, *file, *descr, *p; int lineno; fp = fopen(path_zonetab, "r"); @@ -482,7 +483,7 @@ read_zones(void) err(1, "%s", path_zonetab); lineno = 0; - while ((line = fgetln(fp, &len)) != 0) { + while ((line = fgetln(fp, &len)) != NULL) { lineno++; if (line[len - 1] != '\n') errx(1, "%s:%d: invalid format", path_zonetab, lineno); @@ -494,10 +495,10 @@ read_zones(void) if (strlen(tlc) != 2) errx(1, "%s:%d: invalid country code `%s'", path_zonetab, lineno, tlc); - coord = strsep(&line, "\t"); /* Unused */ + /* coord = */ strsep(&line, "\t"); /* Unused */ file = strsep(&line, "\t"); p = strchr(file, '/'); - if (p == 0) + if (p == NULL) errx(1, "%s:%d: invalid zone name `%s'", path_zonetab, lineno, file); contbuf[0] = '\0'; @@ -557,7 +558,7 @@ make_menus(void) continent_names[i].continent->menu = malloc(sizeof(dialogMenuItem) * continent_names[i].continent->nitems); - if (continent_names[i].continent->menu == 0) + if (continent_names[i].continent->menu == NULL) errx(1, "malloc for continent menu"); continent_names[i].continent->nitems = 0; continents[i].prompt = continent_items[i].prompt; @@ -632,13 +633,13 @@ set_zone_menu(dialogMenuItem *dmi) return (DITEM_LEAVE_MENU); } -int +static int set_zone_utc(void) { if (!confirm_zone(NULL)) return (DITEM_FAILURE | DITEM_RECREATE); - return (install_zoneinfo_file(NULL)); + return (install_zoneinfo("UTC")); } static int