From e8b2ef76c56529a6c74742f4dfbaf691a1eac29c Mon Sep 17 00:00:00 2001 From: Sebastien GODARD Date: Sat, 27 Jan 2018 07:52:11 +0100 Subject: [PATCH] sa_common.c: Use SYSSTAT_MAGIC constant instead of swapping bytes Signed-off-by: Sebastien GODARD --- sa_common.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/sa_common.c b/sa_common.c index 218b928..a10aa3f 100644 --- a/sa_common.c +++ b/sa_common.c @@ -1511,9 +1511,12 @@ int sa_open_read_magic(int *fd, char *dfile, struct file_magic *file_magic, *endian_mismatch = (file_magic->sysstat_magic != SYSSTAT_MAGIC); if (*endian_mismatch) { /* Swap bytes for file_magic fields */ - file_magic->sysstat_magic = __builtin_bswap16(file_magic->sysstat_magic); + file_magic->sysstat_magic = SYSSTAT_MAGIC; file_magic->format_magic = __builtin_bswap16(file_magic->format_magic); - /* Start swapping at field "header_size" position */ + /* + * Start swapping at field "header_size" position. + * May not exist for older versions but in this case, it won't be used. + */ swap_struct(fm_types_nr, &file_magic->header_size, 0); } -- 2.40.0