mirror of
https://github.com/freebsd/freebsd-src.git
synced 2024-12-05 01:30:43 +00:00
- Align the function prototype of the external `crc' function with
how `crc' is actually defined. - Remove an unnecessary `extern' variable declaration. Data type corrections: - Define a variable which contains a file byte offset value as type off_t as required by the `crc' function. - Change the type of a variable carrying a CRC checksum from `u_long' to `uint32_t'. - Substitute the wrong `extern' variable declaration of `crc_total' by putting a correct one in the shared header extern.h. `crc_total' is defined as an `uint32_t', thus fixing incorrect mtree checksums on big-endian LP64 machines.
This commit is contained in:
parent
fadcf8aec0
commit
0357726594
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=112214
@ -79,9 +79,9 @@ compare(name, s, p)
|
||||
register NODE *s;
|
||||
register FTSENT *p;
|
||||
{
|
||||
extern int uflag;
|
||||
u_long len, val;
|
||||
uint32_t val;
|
||||
int fd, label;
|
||||
off_t len;
|
||||
char *cp;
|
||||
const char *tab = "";
|
||||
char *fflags;
|
||||
@ -211,7 +211,7 @@ typeerr: LABEL;
|
||||
if (s->cksum != val) {
|
||||
LABEL;
|
||||
(void)printf("%scksum expected %lu found %lu\n",
|
||||
tab, s->cksum, val);
|
||||
tab, s->cksum, (unsigned long)val);
|
||||
tab = "\t";
|
||||
}
|
||||
}
|
||||
|
@ -68,7 +68,6 @@ static const char rcsid[] =
|
||||
#define INDENTNAMELEN 15
|
||||
#define MAXLINELEN 80
|
||||
|
||||
extern long int crc_total;
|
||||
extern int ftsoptions;
|
||||
extern int dflag, iflag, nflag, sflag;
|
||||
extern u_int keys;
|
||||
@ -142,7 +141,7 @@ cwalk()
|
||||
}
|
||||
(void)fts_close(t);
|
||||
if (sflag && keys & F_CKSUM)
|
||||
warnx("%s checksum: %lu", fullpath, crc_total);
|
||||
warnx("%s checksum: %lu", fullpath, (unsigned long)crc_total);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -152,7 +151,8 @@ statf(indent, p)
|
||||
{
|
||||
struct group *gr;
|
||||
struct passwd *pw;
|
||||
u_long len, val;
|
||||
uint32_t val;
|
||||
off_t len;
|
||||
int fd, offset;
|
||||
char *fflags;
|
||||
char *escaped_name;
|
||||
@ -218,7 +218,7 @@ statf(indent, p)
|
||||
crc(fd, &val, &len))
|
||||
err(1, "line %d: %s", lineno, p->fts_accpath);
|
||||
(void)close(fd);
|
||||
output(indent, &offset, "cksum=%lu", val);
|
||||
output(indent, &offset, "cksum=%lu", (unsigned long)val);
|
||||
}
|
||||
#ifdef MD5
|
||||
if (keys & F_MD5 && S_ISREG(p->fts_statp->st_mode)) {
|
||||
|
@ -33,9 +33,10 @@
|
||||
* @(#)extern.h 8.1 (Berkeley) 6/6/93
|
||||
* $FreeBSD$
|
||||
*/
|
||||
extern uint32_t crc_total;
|
||||
|
||||
int compare(char *, NODE *, FTSENT *);
|
||||
int crc(int, u_long *, u_long *);
|
||||
int crc(int, uint32_t *, off_t *);
|
||||
void cwalk(void);
|
||||
char *flags_to_string(u_long);
|
||||
|
||||
|
@ -55,8 +55,6 @@ static const char rcsid[] =
|
||||
#include "mtree.h"
|
||||
#include "extern.h"
|
||||
|
||||
extern long int crc_total;
|
||||
|
||||
int ftsoptions = FTS_PHYSICAL;
|
||||
int cflag, dflag, eflag, iflag, nflag, qflag, rflag, sflag, uflag, Uflag;
|
||||
u_int keys;
|
||||
@ -126,7 +124,7 @@ main(int argc, char *argv[])
|
||||
break;
|
||||
case 's':
|
||||
sflag = 1;
|
||||
crc_total = ~strtol(optarg, &p, 0);
|
||||
crc_total = ~strtoul(optarg, &p, 0);
|
||||
if (*p)
|
||||
errx(1, "illegal seed value -- %s", optarg);
|
||||
case 'U':
|
||||
|
@ -51,7 +51,6 @@ static const char rcsid[] =
|
||||
#include "mtree.h"
|
||||
#include "extern.h"
|
||||
|
||||
extern long int crc_total;
|
||||
extern int ftsoptions;
|
||||
extern int dflag, eflag, qflag, rflag, sflag, uflag;
|
||||
extern char fullpath[MAXPATHLEN];
|
||||
@ -155,7 +154,7 @@ extra:
|
||||
}
|
||||
(void)fts_close(t);
|
||||
if (sflag)
|
||||
warnx("%s checksum: %lu", fullpath, crc_total);
|
||||
warnx("%s checksum: %lu", fullpath, (unsigned long)crc_total);
|
||||
return (rval);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user