[PATCH 2/4] Fix wrong balance of if/else blocks

Dmitry V. Levin ldv at altlinux.org
Sat Sep 4 11:59:34 UTC 2021


On Sat, Sep 04, 2021 at 05:28:41AM +0900, Masatake YAMATO wrote:
> * src/time (printclockname): Add `{' and `}'.
> 
> Signed-off-by: Masatake YAMATO <yamato at redhat.com>
> ---
>  src/time.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/src/time.c b/src/time.c
> index 656e4bee1..f4a6a7539 100644
> --- a/src/time.c
> +++ b/src/time.c
> @@ -246,10 +246,10 @@ printclockname(struct tcb *const tcp, int clockid)
>  		if (xlat_verbose(xlat_verbosity) == XLAT_STYLE_VERBOSE)
>  			tprint_comment_begin();
>  
> -		if ((clockid & CLOCKFD_MASK) == CLOCKFD)
> +		if ((clockid & CLOCKFD_MASK) == CLOCKFD) {
>  			tprints_arg_begin("FD_TO_CLOCKID");
>  			PRINT_VAL_D(CLOCKID_TO_FD(clockid));
> -		else {
> +		} else {
>  			tprints_arg_begin(CPUCLOCK_PERTHREAD(clockid) ?
>  					  "MAKE_THREAD_CPUCLOCK" :
>  					  "MAKE_PROCESS_CPUCLOCK");

Fixes: v5.12~80 "time: use print_fields.h helpers"

I wonder, however, do we want to keep this #ifdef CLOCKID_TO_FD
code, given that it never compiles because CLOCKID_TO_FD
is not defined?

Note that CLOCKID_TO_FD constant was never a part of UAPI
(it was defined in include/linux/posix-timers.h)
and Linux kernel commit v4.16-rc1~176^2~54 replaced it with
static inline int clockid_to_fd(const clockid_t clk)
so it would probably make sense to use new names
if we want to keep this translation at all.


-- 
ldv


More information about the Strace-devel mailing list