All of lore.kernel.org
 help / color / mirror / Atom feed
From: Cyril Hrubis <chrubis@suse.cz>
To: jiaying.song.cn@windriver.com
Cc: ltp@lists.linux.it
Subject: Re: [LTP] [PATCH] syscalls/time01:Avoid using TST_RET in time() test to support Y2038-safe time_t
Date: Fri, 19 Sep 2025 18:05:25 +0200	[thread overview]
Message-ID: <aM1_RTDldCgMmajC@yuki.lan> (raw)
In-Reply-To: <20250519064955.2061913-1-jiaying.song.cn@windriver.com>

Hi!
Sorry for the late reply.

> +        time_t ret_time = time(tloc);        
> +        
> +        ret_time = time(tloc);
>  
> -	TEST(time(tloc));
> -
> -	if (TST_RET == -1) {
> +	if (ret_time == -1) {
>  		tst_res(TFAIL | TTERRNO, "time()");
>  		return;
>  	}
>  
>  	if (!tloc)
> -		tst_res(TPASS, "time() returned value %ld", TST_RET);
> -	else if (*tloc == TST_RET)
> +		tst_res(TPASS, "time() returned value %lld", ret_time);
> +	else if (*tloc == ret_time)
>  		tst_res(TPASS,
> -			"time() returned value %ld, stored value %jd are same",
> -			TST_RET, (intmax_t) *tloc);
> +			"time() returned value %lld, stored value %jd are same",
> +			ret_time, (intmax_t) *tloc);

The ret_time needs a cast, since it's not always long long. Or we can
just use the %jd and cast to (intmax_t) as we do for the tloc argument.

>  	else
>  		tst_res(TFAIL,
> -			"time() returned value %ld, stored value %jd are different",
> -			TST_RET, (intmax_t) *tloc);
> +			"time() returned value %lld, stored value %jd are different",
> +			ret_time, (intmax_t) *tloc);
>  }

Here as well.

-- 
Cyril Hrubis
chrubis@suse.cz

-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

  reply	other threads:[~2025-09-19 16:05 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-05-19  6:49 [LTP] [PATCH] syscalls/time01:Avoid using TST_RET in time() test to support Y2038-safe time_t Jiaying Song via ltp
2025-09-19 16:05 ` Cyril Hrubis [this message]
  -- strict thread matches above, loose matches on Subject: below --
2025-10-20 11:13 Jiaying Song via ltp
2025-11-07 12:19 ` Petr Vorel

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=aM1_RTDldCgMmajC@yuki.lan \
    --to=chrubis@suse.cz \
    --cc=jiaying.song.cn@windriver.com \
    --cc=ltp@lists.linux.it \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.