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>
This commit is contained in:
Roman Kapl 2019-02-08 10:01:02 +01:00 committed by Tom Rini
parent 957f51e863
commit 44ac80e7e9

View File

@ -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);