]> granicus.if.org Git - sysstat/commitdiff
sa_common.c: Use SYSSTAT_MAGIC constant instead of swapping bytes
authorSebastien GODARD <sysstat@users.noreply.github.com>
Sat, 27 Jan 2018 06:52:11 +0000 (07:52 +0100)
committerSebastien GODARD <sysstat@users.noreply.github.com>
Sat, 27 Jan 2018 06:52:11 +0000 (07:52 +0100)
Signed-off-by: Sebastien GODARD <sysstat@users.noreply.github.com>
sa_common.c

index 218b92888e04a66ff3108142d0170f7ec8c7dced..a10aa3fd7a60b1e174e6ca6bd27d9c6e3049d227 100644 (file)
@@ -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);
        }