From owner-svn-src-all@freebsd.org Mon Jan 1 23:22:21 2018 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 455A8E8AB9F; Mon, 1 Jan 2018 23:22:21 +0000 (UTC) (envelope-from freebsd@pdx.rh.CN85.dnsmgr.net) Received: from pdx.rh.CN85.dnsmgr.net (br1.CN84in.dnsmgr.net [69.59.192.140]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id A2EFA3737; Mon, 1 Jan 2018 23:22:20 +0000 (UTC) (envelope-from freebsd@pdx.rh.CN85.dnsmgr.net) Received: from pdx.rh.CN85.dnsmgr.net (localhost [127.0.0.1]) by pdx.rh.CN85.dnsmgr.net (8.13.3/8.13.3) with ESMTP id w01NMJgD088581; Mon, 1 Jan 2018 15:22:19 -0800 (PST) (envelope-from freebsd@pdx.rh.CN85.dnsmgr.net) Received: (from freebsd@localhost) by pdx.rh.CN85.dnsmgr.net (8.13.3/8.13.3/Submit) id w01NMJtw088580; Mon, 1 Jan 2018 15:22:19 -0800 (PST) (envelope-from freebsd) From: "Rodney W. Grimes" Message-Id: <201801012322.w01NMJtw088580@pdx.rh.CN85.dnsmgr.net> Subject: Re: svn commit: r327476 - head/sbin/shutdown In-Reply-To: To: Eitan Adler Date: Mon, 1 Jan 2018 15:22:19 -0800 (PST) CC: Ian Lepore , "src-committers@freebsd.org" , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" Reply-To: rgrimes@freebsd.org X-Mailer: ELM [version 2.4ME+ PL121h (25)] MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 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: Mon, 01 Jan 2018 23:22:21 -0000 [ Charset UTF-8 unsupported, converting... ] > On Monday, 1 January 2018, Ian Lepore wrote: > > > On Mon, 2018-01-01 at 22:33 +0000, Eitan Adler wrote: > > > Author: eadler > > > Date: Mon Jan 1 22:33:57 2018 > > > New Revision: 327476 > > > URL: https://svnweb.freebsd.org/changeset/base/327476 > > > > > > Log: > > > shutdown: Assume absolute time is in the future > > > > > [...] > > > Modified: head/sbin/shutdown/shutdown.c > > > ============================================================ > > ================== > > > --- head/sbin/shutdown/shutdown.c Mon Jan 1 22:31:52 2018 > > (r327475) > > > +++ head/sbin/shutdown/shutdown.c Mon Jan 1 22:33:57 2018 > > (r327476) > > > @@ -431,7 +431,7 @@ getoffset(char *timearg) > > > struct tm *lt; > > > char *p; > > > time_t now; > > > - int this_year; > > > + int this_year, maybe_today; Please sort in alpha order here too, since your gona have to commit anyway. int maybe_today, this_year; > > > char *timeunit; > > > > > > (void)time(&now); > > > @@ -503,6 +503,7 @@ getoffset(char *timearg) > > > badtime(); > > > /* FALLTHROUGH */ > > > case 6: > > > + maybe_today = 0; > > > lt->tm_mday = ATOI2(timearg); > > > if (lt->tm_mday < 1 || lt->tm_mday > 31) > > > badtime(); > > > @@ -517,8 +518,23 @@ getoffset(char *timearg) > > > lt->tm_sec = 0; > > > if ((shuttime = mktime(lt)) == -1) > > > badtime(); > > > - if ((offset = shuttime - now) < 0) > > > - errx(1, "that time is already past."); > > > + > > > + if ((offset = shuttime - now) < 0) { > > > + if (!maybe_today) > > > + errx(1, "that time is already past."); > > > + > > > + /* > > > + * If the user only gave a time, assume that > > > + * any time earlier than the current time > > > + * was intended to be that time tomorrow. > > > + */ > > > + lt->tm_mday++; > > > + if ((shuttime = mktime(lt)) == -1) > > > + badtime(); > > > + if ((offset = shuttime - now) < 0) { > > > + errx(1, "tomorrow is before today?"); > > > + } > > > + } > > > break; > > > default: > > > badtime(); > > > > > > > Where does maybe_today ever get set to non-zero? > > > Baah. This is what happens when my build/test and commit box are not the > same. Will fix later when I get back home. > > > > > -- Ian > > > > > -- > Sent from my Turing Machine -- Rod Grimes rgrimes@freebsd.org