[LTP] [PATCH 1/2] lib: tst_test: Make IPC magic spells 'LTPM'

Li Wang liwang@redhat.com
Fri Jun 27 12:36:47 CEST 2025


On Fri, Jun 27, 2025 at 6:29 PM Cyril Hrubis <chrubis@suse.cz> wrote:

> Since the 'LTPM' string is encoded in an integer the order of the
> letters depends on machine endianity. On little endian it was actually
> spelled backwards i.e. 'MPTL'.
>
> This patch fixes that by making sure that the bytes are in the right
> order.
>
> Signed-off-by: Cyril Hrubis <chrubis@suse.cz>
>

This is cleaner than my patchset, thanks!

For two patches:

Acked-by: Li Wang <liwang@redhat.com>


---
>  lib/tst_test.c | 8 +++++++-
>  1 file changed, 7 insertions(+), 1 deletion(-)
>
> diff --git a/lib/tst_test.c b/lib/tst_test.c
> index 495e022f7..17ce91932 100644
> --- a/lib/tst_test.c
> +++ b/lib/tst_test.c
> @@ -52,7 +52,13 @@ const char *TCID __attribute__((weak));
>  #define CVE_DB_URL "https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-"
>
>  #define DEFAULT_TIMEOUT 30
> -#define LTP_MAGIC 0x4C54504D /* Magic number is "LTPM" */
> +
> +/* Magic number is "LTPM" */
> +#if __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__
> +# define LTP_MAGIC 0x4C54504D
> +#else
> +# define LTP_MAGIC 0x4D50544C
> +#endif
>
>  struct tst_test *tst_test;
>
> --
> 2.49.0
>
>
> --
> Mailing list info: https://lists.linux.it/listinfo/ltp
>
>

-- 
Regards,
Li Wang


More information about the ltp mailing list