From: Sebastien GODARD Date: Sat, 27 Jan 2018 06:52:11 +0000 (+0100) Subject: sa_common.c: Use SYSSTAT_MAGIC constant instead of swapping bytes X-Git-Tag: v11.7.2~35 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=e8b2ef76c56529a6c74742f4dfbaf691a1eac29c;p=sysstat sa_common.c: Use SYSSTAT_MAGIC constant instead of swapping bytes Signed-off-by: Sebastien GODARD --- 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); }