cksum: fix --raw on 64 bit big endian systems
commita8e6e627f1a1142ec9cb273cfadc3f9aa2aa412a
authorPádraig Brady <P@draigBrady.com>
Wed, 15 Mar 2023 13:57:37 +0000 (15 13:57 +0000)
committerPádraig Brady <P@draigBrady.com>
Wed, 15 Mar 2023 14:05:38 +0000 (15 14:05 +0000)
treefad43bc93ad36549f7581179ccbc6a2d345bd9c0
parentf1ff021247304698ae71892060330bcb91683d70
cksum: fix --raw on 64 bit big endian systems

* src/sum.c (output_bsd): On sparc64 for example,
a crc of 0 was output due to casting an int variable
to uint16_t and thus operating on the wrong end of the variable.
Instead use explicit assignment to the narrower type
to ensure we get the appropriate data.
(output_sysv): Likewise.
Reported by Bruno Haible.
src/sum.c