Correct some error strings, and add a few more. Don't print error messages in
exec(); let the caller do it.
This commit is contained in:
parent
248e7ebfb0
commit
cba39e9e88
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: exec.c,v 1.7 1995/02/21 07:14:37 mycroft Exp $ */
|
||||
/* $NetBSD: exec.c,v 1.8 1995/02/21 07:38:37 mycroft Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1982, 1986, 1990, 1993
|
||||
@ -78,8 +78,7 @@ exec(path, loadaddr, howto)
|
||||
i = read(io, (char *)&x, sizeof(x));
|
||||
if (i != sizeof(x) ||
|
||||
N_BADMAG(x)) {
|
||||
printf("exec: %s: Bad format\n", path);
|
||||
errno = ENOEXEC;
|
||||
errno = EFTYPE;
|
||||
return;
|
||||
}
|
||||
|
||||
@ -126,13 +125,15 @@ exec(path, loadaddr, howto)
|
||||
i -= sizeof(int);
|
||||
addr += sizeof(int);
|
||||
if (read(io, addr, i) != i)
|
||||
goto shread;
|
||||
goto shread;
|
||||
addr += i;
|
||||
}
|
||||
|
||||
/* and that many bytes of (debug symbols?) */
|
||||
printf("+%d]", i);
|
||||
|
||||
close(io);
|
||||
|
||||
#define round_to_size(x) \
|
||||
(((int)(x) + sizeof(int) - 1) & ~(sizeof(int) - 1))
|
||||
esym = (char *)round_to_size(addr - loadaddr);
|
||||
@ -153,13 +154,11 @@ exec(path, loadaddr, howto)
|
||||
machdep_start((char *)x.a_entry, howto, loadaddr, ssym, esym);
|
||||
|
||||
/* exec failed */
|
||||
printf("%s: Cannot exec\n", path);
|
||||
errno = ENOEXEC;
|
||||
return;
|
||||
|
||||
shread:
|
||||
close(io);
|
||||
printf("%s: Short read\n", path);
|
||||
errno = EIO;
|
||||
return;
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: strerror.c,v 1.4 1994/10/26 05:45:08 cgd Exp $ */
|
||||
/* $NetBSD: strerror.c,v 1.5 1995/02/21 07:38:38 mycroft Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1993
|
||||
@ -58,13 +58,19 @@ static char ebuf[1024];
|
||||
case EUNLAB:
|
||||
return "unlabeled";
|
||||
case ENXIO:
|
||||
return "bad device specification";
|
||||
return "Device not configured";
|
||||
case EPERM:
|
||||
return "Permission Denied";
|
||||
return "Operation not permitted";
|
||||
case ENOENT:
|
||||
return "No such file or directory";
|
||||
case ESTALE:
|
||||
return "Stale NFS file handle";
|
||||
case EFTYPE:
|
||||
return "Inappropriate file type or format";
|
||||
case ENOEXEC:
|
||||
return "Exec format error";
|
||||
case EIO:
|
||||
return "Input/output error";
|
||||
|
||||
default:
|
||||
strcpy(ebuf, "Unknown error: code ");
|
||||
|
Loading…
Reference in New Issue
Block a user