aboutsummaryrefslogtreecommitdiff
path: root/cmd
diff options
context:
space:
mode:
authorRoman Kapl2019-02-08 10:01:02 +0100
committerTom Rini2019-02-19 08:55:43 -0500
commit44ac80e7e90ff1c6630b64b3babe03cc6bdef46a (patch)
treed72c8b66d1f3bf17ed5fb0953d869ecc8dc59c80 /cmd
parent957f51e86367e14be9e40cfe5cc3a494fc17abcf (diff)
cmd: date: Do not overwrite arguments
Arguments are const and belong to the caller. Calling date in a hush loop will yield different results from the second invocation. Signed-off-by: Roman Kapl <rka@sysgo.com>
Diffstat (limited to 'cmd')
-rw-r--r--cmd/date.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/cmd/date.c b/cmd/date.c
index 1115b6c8d67..7fa950a9026 100644
--- a/cmd/date.c
+++ b/cmd/date.c
@@ -159,18 +159,18 @@ int mk_date (const char *datestr, struct rtc_time *tmp)
int len, val;
char *ptr;
- ptr = strchr (datestr,'.');
- len = strlen (datestr);
+ ptr = strchr(datestr, '.');
+ len = strlen(datestr);
/* Set seconds */
if (ptr) {
int sec;
- *ptr++ = '\0';
+ ptr++;
if ((len - (ptr - datestr)) != 2)
return (-1);
- len = strlen (datestr);
+ len -= 3;
if (cnvrt2 (ptr, &sec))
return (-1);