From: brarcher Date: Mon, 23 Sep 2013 15:17:50 +0000 (+0000) Subject: initialize timespec's to {0} X-Git-Tag: 0.10.0~430 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=b7261cecef4740eebcdedbcb1abd9f343999b4cf;p=check initialize timespec's to {0} In case the clock_gettime call fails, the timespec values need to be a sane value. git-svn-id: svn+ssh://svn.code.sf.net/p/check/code/trunk@784 64e312b2-a51f-0410-8e61-82d0ca0eb02a --- diff --git a/src/check_log.c b/src/check_log.c index 070986a..2bbacdb 100644 --- a/src/check_log.c +++ b/src/check_log.c @@ -231,7 +231,7 @@ void xml_lfun (SRunner *sr CK_ATTRIBUTE_UNUSED, FILE *file, enum print_output pr { TestResult *tr; Suite *s; - static struct timespec ts_start; + static struct timespec ts_start = {0}; static char t[sizeof "yyyy-mm-dd hh:mm:ss"] = {0}; if (t[0] == 0) @@ -253,7 +253,7 @@ void xml_lfun (SRunner *sr CK_ATTRIBUTE_UNUSED, FILE *file, enum print_output pr break; case CLENDLOG_SR: { - struct timespec ts_end; + struct timespec ts_end = {0}; unsigned int duration; /* calculate time the test were running */ diff --git a/src/check_run.c b/src/check_run.c index b516471..d41943e 100644 --- a/src/check_run.c +++ b/src/check_run.c @@ -318,7 +318,7 @@ static void srunner_run_tcase (SRunner *sr, TCase *tc) static TestResult *tcase_run_tfun_nofork (SRunner *sr, TCase *tc, TF *tfun, int i) { TestResult *tr; - struct timespec ts_start, ts_end; + struct timespec ts_start={0}, ts_end={0}; tr = tcase_run_checked_setup(sr, tc); if (tr == NULL) { @@ -377,7 +377,7 @@ static TestResult *tcase_run_tfun_fork (SRunner *sr, TCase *tc, TF *tfun, int i) pid_t pid_w; pid_t pid; int status = 0; - struct timespec ts_start, ts_end; + struct timespec ts_start = {0}, ts_end = {0}; int timer_create_result; timer_t timerid;