Accept mid=0, for Athena 4.3BSD, Ultrix, and 4.3BSD-Quasijarus0c.

This commit is contained in:
Boris Gjenero
2020-10-22 23:21:42 -04:00
parent 7b0f60bf54
commit e51c192467
2 changed files with 15 additions and 2 deletions

View File

@@ -298,6 +298,10 @@ getMID(int old_mid, int new_mid)
mid = old_mid;
switch (new_mid) {
/* 0 is used by Athena 4.3BSD, Ultrix, and 4.3BSD-Quasijarus0c */
case 0:
mid = 0;
break;
case MID_I386:
mid = MID_I386;
break;
@@ -362,11 +366,13 @@ getCLBYTES(int mid)
int clbytes;
switch (mid) {
/* This works for Athena 4.3BSD. Is it valid for all mid == 0? */
case 0:
#ifdef MID_VAX1K
case MID_VAX1K:
#endif
clbytes = 1024;
break;
#endif
#ifdef MID_I386
case MID_I386:
#endif
@@ -644,6 +650,11 @@ CheckAOutFile(int fd)
(void)lseek(fd, (off_t) 0, SEEK_SET);
/* If mid == 0 is accepted, this is needed to avoid false positives. */
if (N_BADMAG (ex) && N_BADMAG (ex_swap)) {
return(-1);
}
mid = getMID(mid, N_GETMID (ex));
if (mid == -1) {

View File

@@ -129,7 +129,9 @@ main(int argc, char **argv)
#ifndef NOAOUT
case IMAGE_TYPE_AOUT:
if (dl.a_mid != MID_VAX && dl.a_mid != MID_VAX1K)
if (dl.a_mid == 0)
printf("WARNING: `%s' has mid=0\n", argv[1]);
else if (dl.a_mid != MID_VAX && dl.a_mid != MID_VAX1K)
printf("WARNING: `%s' is not a VAX image (mid=%d)\n",
argv[1], dl.a_mid);
i = dl.a_text + dl.a_text_fill + dl.a_data + dl.a_data_fill +