Page MenuHomeFreeBSD

D44504.diff
No OneTemporary

D44504.diff

diff --git a/usr.bin/touch/touch.c b/usr.bin/touch/touch.c
--- a/usr.bin/touch/touch.c
+++ b/usr.bin/touch/touch.c
@@ -232,7 +232,7 @@
}
yearset = 0;
- switch(strlen(arg)) {
+ switch (strlen(arg)) {
case 12: /* CCYYMMDDhhmm */
t->tm_year = ATOI2(arg);
t->tm_year *= 100;
@@ -263,15 +263,17 @@
}
t->tm_isdst = -1; /* Figure out DST. */
+ t->tm_yday = -1;
tvp[0].tv_sec = tvp[1].tv_sec = mktime(t);
- if (tvp[0].tv_sec == -1)
+ if (t->tm_yday == -1)
goto terr;
tvp[0].tv_nsec = tvp[1].tv_nsec = 0;
return;
terr:
- errx(1, "out of range or illegal time specification: [[CC]YY]MMDDhhmm[.SS]");
+ errx(1, "out of range or illegal time specification: "
+ "[[CC]YY]MMDDhhmm[.SS]");
}
static void
@@ -296,10 +298,11 @@
}
t->tm_isdst = -1; /* Figure out DST. */
+ t->tm_yday = -1;
tvp[0].tv_sec = tvp[1].tv_sec = mktime(t);
- if (tvp[0].tv_sec == -1)
- errx(1,
- "out of range or illegal time specification: MMDDhhmm[yy]");
+ if (t->tm_yday == -1)
+ errx(1, "out of range or illegal time specification: "
+ "MMDDhhmm[yy]");
tvp[0].tv_nsec = tvp[1].tv_nsec = 0;
}
@@ -339,13 +342,17 @@
if (*p != '\0')
goto bad;
+ t.tm_yday = -1;
tvp[0].tv_sec = isutc ? timegm(&t) : mktime(&t);
+ if (t.tm_yday == -1)
+ goto bad;
tvp[1] = tvp[0];
return;
bad:
- errx(1, "out of range or illegal time specification: YYYY-MM-DDThh:mm:SS[.frac][tz]");
+ errx(1, "out of range or illegal time specification: "
+ "YYYY-MM-DDThh:mm:SS[.frac][tz]");
}
/* Calculate a time offset in seconds, given an arg of the format [-]HHMMSS. */

File Metadata

Mime Type
text/plain
Expires
Thu, Nov 7, 1:26 PM (22 h, 2 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
14513299
Default Alt Text
D44504.diff (1 KB)

Event Timeline