Skip to content

Commit 4218a54

Browse files
bozutafmetan-ucw
authored andcommitted
lib/tst_clocks.c: fix 'tst_clock_gettime()' and 'tst_clock_settime()'
The type of 'struct tst_ts' has to be kept between function calls because a function can be called with the wrong timespec type. For that reason, a 'static' identifier is added for 'tts' in 'tst_clock_gettime()' and 'tst_clock_settime()' as to make sure the right timespec type is passed in 'clock_gettime()' and 'clock_settime()'. Signed-off-by: Filip Bozuta <[email protected]> Reviewed-by: Cyril Hrubis <[email protected]>
1 parent de36948 commit 4218a54

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

lib/tst_clocks.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ int tst_clock_getres(clockid_t clk_id, struct timespec *res)
5757

5858
int tst_clock_gettime(clockid_t clk_id, struct timespec *ts)
5959
{
60-
struct tst_ts tts = { 0, };
60+
static struct tst_ts tts = { 0, };
6161
static mysyscall func;
6262
int ret;
6363

@@ -87,7 +87,7 @@ int tst_clock_gettime(clockid_t clk_id, struct timespec *ts)
8787

8888
int tst_clock_settime(clockid_t clk_id, struct timespec *ts)
8989
{
90-
struct tst_ts tts = { 0, };
90+
static struct tst_ts tts = { 0, };
9191
static mysyscall func;
9292

9393
#if (__NR_clock_settime64 != __LTP__NR_INVALID_SYSCALL)

0 commit comments

Comments
 (0)