rimage: add error handler for localtime call

Signed-off-by: Pan Xiuli <xiuli.pan@linux.intel.com>
This commit is contained in:
Pan Xiuli 2018-05-11 15:55:40 +08:00 committed by Daniel Leung
parent 3530b55759
commit 82f6d74ee3
1 changed files with 6 additions and 0 deletions

View File

@ -32,6 +32,12 @@ void ri_css_hdr_create(struct image *image)
/* get local time and date */
gettimeofday(&tv, NULL);
date = localtime(&tv.tv_sec);
if (!date) {
fprintf(stderr, "error: cant get localtime %d\n", -errno);
return;
}
date->tm_year += 1900;
fprintf(stdout, " css: set build date to %d:%2.2d:%2.2d\n",
date->tm_year, date->tm_mon, date->tm_mday);