]> granicus.if.org Git - check/commitdiff
initialize timespec's to {0}
authorbrarcher <brarcher@64e312b2-a51f-0410-8e61-82d0ca0eb02a>
Mon, 23 Sep 2013 15:17:50 +0000 (15:17 +0000)
committerbrarcher <brarcher@64e312b2-a51f-0410-8e61-82d0ca0eb02a>
Mon, 23 Sep 2013 15:17:50 +0000 (15:17 +0000)
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

src/check_log.c
src/check_run.c

index 070986a9e211c363dad8a45a0a8c6c963ce560d1..2bbacdb3ff3faff04b4748a9f85efec358115c84 100644 (file)
@@ -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 */
index b516471942f484e2c4304195c626cecad7a2c8b7..d41943e7b6b5f2ab5c0dbdd3c957018a0112abdf 100644 (file)
@@ -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;