Fixes for Alpha, from Hideo MASUDA (h-masuda@jm3spa.felix.or.jp), in

PR bin/6284, slightly munged about for platforms which aren't LP64.

Also, don't use hardcoded strings (or their lengths) when we've
already defined them in a common header file.
This commit is contained in:
agc 1998-10-13 10:00:09 +00:00
parent ff0134b99f
commit 5e8df8cb74
2 changed files with 15 additions and 12 deletions

View File

@ -1,11 +1,11 @@
/* $NetBSD: file.c,v 1.19 1998/10/08 12:58:00 agc Exp $ */
/* $NetBSD: file.c,v 1.20 1998/10/13 10:00:09 agc Exp $ */
#include <sys/cdefs.h>
#ifndef lint
#if 0
static const char *rcsid = "from FreeBSD Id: file.c,v 1.29 1997/10/08 07:47:54 charnier Exp";
#else
__RCSID("$NetBSD: file.c,v 1.19 1998/10/08 12:58:00 agc Exp $");
__RCSID("$NetBSD: file.c,v 1.20 1998/10/13 10:00:09 agc Exp $");
#endif
#endif
@ -472,8 +472,8 @@ make_preserve_name(char *try, size_t max, char *name, char *file)
void
write_file(char *name, char *str)
{
FILE *fp;
size_t len;
FILE *fp;
if ((fp = fopen(name, "w")) == (FILE *) NULL) {
cleanup(0);
@ -482,8 +482,8 @@ write_file(char *name, char *str)
len = strlen(str);
if (fwrite(str, 1, len, fp) != len) {
cleanup(0);
errx(2, "short fwrite on '%s', tried to write %d bytes",
name, len);
errx(2, "short fwrite on '%s', tried to write %ld bytes",
name, (long) len);
}
if (fclose(fp)) {
cleanup(0);

View File

@ -1,11 +1,11 @@
/* $NetBSD: plist.c,v 1.14 1998/10/12 12:03:26 agc Exp $ */
/* $NetBSD: plist.c,v 1.15 1998/10/13 10:00:10 agc Exp $ */
#include <sys/cdefs.h>
#ifndef lint
#if 0
static const char *rcsid = "from FreeBSD Id: plist.c,v 1.24 1997/10/08 07:48:15 charnier Exp";
#else
__RCSID("$NetBSD: plist.c,v 1.14 1998/10/12 12:03:26 agc Exp $");
__RCSID("$NetBSD: plist.c,v 1.15 1998/10/13 10:00:10 agc Exp $");
#endif
#endif
@ -181,7 +181,7 @@ new_plist_entry(void)
plist_t *ret;
if ((ret = (plist_t *)malloc(sizeof(plist_t))) == (plist_t *) NULL) {
err(1, "can't allocate %d bytes", sizeof(plist_t));
err(1, "can't allocate %ld bytes", (long) sizeof(plist_t));
}
memset(ret, 0, sizeof(plist_t));
return ret;
@ -339,15 +339,18 @@ delete_package(Boolean ign_err, Boolean nukedirs, package_t *pkg)
"this packing list is incorrect - ignoring delete request", tmp);
}
else {
if (p->next && p->next->type == PLIST_COMMENT && !strncmp(p->next->name, "MD5:", 4)) {
if (p->next &&
p->next->type == PLIST_COMMENT &&
strncmp(p->next->name, CHECKSUM_HEADER, ChecksumHeaderLen) == 0) {
char *cp, buf[LegibleChecksumLen];
if ((cp = MD5File(tmp, buf)) != NULL) {
/* Mismatch? */
if (strcmp(cp, p->next->name + 4)) {
if (Verbose)
if (strcmp(cp, p->next->name + ChecksumHeaderLen) != 0) {
if (Verbose) {
printf("%s fails original MD5 checksum - %s\n",
tmp, Force ? "deleted anyway." : "not deleted.");
}
if (!Force) {
fail = FAIL;
continue;
@ -359,7 +362,7 @@ delete_package(Boolean ign_err, Boolean nukedirs, package_t *pkg)
printf("Delete file %s\n", tmp);
if (!Fake) {
if (delete_hierarchy(tmp, ign_err, nukedirs))
fail = FAIL;
fail = FAIL;
if (preserve && name) {
char tmp2[FILENAME_MAX];