FreeBSD Bugzilla – Attachment 17930 Details for
Bug 32411
shutdown(8) absolute-time handling could be more useful
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
file.diff
file.diff (text/plain), 2.09 KB, created by
Garrett A. Wollman
on 2001-11-30 20:30:01 UTC
(
hide
)
Description:
file.diff
Filename:
MIME Type:
Creator:
Garrett A. Wollman
Created:
2001-11-30 20:30:01 UTC
Size:
2.09 KB
patch
obsolete
>Index: shutdown.8 >=================================================================== >RCS file: /home/cvs/src/sbin/shutdown/shutdown.8,v >retrieving revision 1.17 >diff -u -r1.17 shutdown.8 >--- shutdown.8 2001/08/09 06:27:32 1.17 >+++ shutdown.8 2001/11/30 20:16:12 >@@ -118,6 +118,13 @@ > to the current system values. The first form brings the system down in > .Ar number > minutes and the second at the absolute time specified. >+If an absolute time is specified, but not a date, >+and that time today has already passed, >+.Nm >+will assume that the same time tomorrow was meant. >+(If a complete date is specified which has already passed, >+.Nm >+will print an error and exit without shutting the system down.) > .It Ar warning-message > Any other arguments comprise the warning message that is broadcast > to users currently logged into the system. >Index: shutdown.c >=================================================================== >RCS file: /home/cvs/src/sbin/shutdown/shutdown.c,v >retrieving revision 1.22 >diff -u -r1.22 shutdown.c >--- shutdown.c 2001/07/15 05:46:07 1.22 >+++ shutdown.c 2001/11/30 20:10:31 >@@ -400,8 +400,9 @@ > struct tm *lt; > char *p; > time_t now; >- int this_year; >+ int this_year, maybe_today; > >+ maybe_today = 1; > (void)time(&now); > > if (!strcasecmp(timearg, "now")) { /* now */ >@@ -454,6 +455,7 @@ > badtime(); > /* FALLTHROUGH */ > case 6: >+ maybe_today = 0; > lt->tm_mday = ATOI2(timearg); > if (lt->tm_mday < 1 || lt->tm_mday > 31) > badtime(); >@@ -468,8 +470,24 @@ > 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) { >+ warnx("tomorrow is before today?"); >+ abort(); >+ } >+ } > break; > default: > badtime();
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 32411
: 17930