summaryrefslogtreecommitdiffstats
path: root/usr.bin/cksum/crc.c
diff options
context:
space:
mode:
authorjb <jb@FreeBSD.org>1998-03-10 05:03:49 +0000
committerjb <jb@FreeBSD.org>1998-03-10 05:03:49 +0000
commit3993727e630e0d7a6b7efef91fa8eb08cf4b62bf (patch)
tree5a3faab89b17f643a7a86dfb08ce976dd9534067 /usr.bin/cksum/crc.c
parent757dddeeb5cd4b11dbbab454753dcdef1458bb26 (diff)
downloadFreeBSD-src-3993727e630e0d7a6b7efef91fa8eb08cf4b62bf.zip
FreeBSD-src-3993727e630e0d7a6b7efef91fa8eb08cf4b62bf.tar.gz
cksum does a 32-bit checksum, so it needs to use u_int32_t variables,
not u_long. With this change, cksum stops core dumping on alpha (not a good sign!) and actually computes the same values as it does on i386.
Diffstat (limited to 'usr.bin/cksum/crc.c')
-rw-r--r--usr.bin/cksum/crc.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/usr.bin/cksum/crc.c b/usr.bin/cksum/crc.c
index 2a5eb6d..3526395 100644
--- a/usr.bin/cksum/crc.c
+++ b/usr.bin/cksum/crc.c
@@ -41,7 +41,7 @@ static char sccsid[] = "@(#)crc.c 8.1 (Berkeley) 6/17/93";
#include <sys/types.h>
#include <unistd.h>
-static u_long crctab[] = {
+static const u_int32_t crctab[] = {
0x0,
0x04c11db7, 0x09823b6e, 0x0d4326d9, 0x130476dc, 0x17c56b6b,
0x1a864db2, 0x1e475005, 0x2608edb8, 0x22c9f00f, 0x2f8ad6d6,
@@ -102,16 +102,16 @@ static u_long crctab[] = {
* locations to store the crc and the number of bytes read. It returns 0 on
* success and 1 on failure. Errno is set on failure.
*/
-u_long crc_total = ~0; /* The crc over a number of files. */
+u_int32_t crc_total = ~0; /* The crc over a number of files. */
int
crc(fd, cval, clen)
register int fd;
- u_long *cval, *clen;
+ u_int32_t *cval, *clen;
{
register u_char *p;
register int nr;
- register u_long crc, len;
+ register u_int32_t crc, len;
u_char buf[16 * 1024];
#define COMPUTE(var, ch) (var) = (var) << 8 ^ crctab[(var) >> 24 ^ (ch)]
OpenPOWER on IntegriCloud