selftests/timers: Add missing error code assignment before test
authorChristophe JAILLET <christophe.jaillet@wanadoo.fr>
Tue, 9 Aug 2016 10:11:26 +0000 (12:11 +0200)
committerShuah Khan <shuahkh@osg.samsung.com>
Tue, 20 Sep 2016 15:00:28 +0000 (09:00 -0600)
In order to work, the 'err' return value has to be updated otherwise the
test can never be true.

Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Acked-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Shuah Khan <shuahkh@osg.samsung.com>
tools/testing/selftests/timers/posix_timers.c

index 5a246a02dff3c6986a1bd06496473ec5be1fd252..15cf56d32155328d7ea064988b2539f4d6e2157a 100644 (file)
@@ -122,7 +122,7 @@ static int check_itimer(int which)
        else if (which == ITIMER_REAL)
                idle_loop();
 
-       gettimeofday(&end, NULL);
+       err = gettimeofday(&end, NULL);
        if (err < 0) {
                perror("Can't call gettimeofday()\n");
                return -1;
@@ -175,7 +175,7 @@ static int check_timer_create(int which)
 
        user_loop();
 
-       gettimeofday(&end, NULL);
+       err = gettimeofday(&end, NULL);
        if (err < 0) {
                perror("Can't call gettimeofday()\n");
                return -1;