summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTobias Weingartner <weingart@cvs.openbsd.org>1997-03-31 04:20:09 +0000
committerTobias Weingartner <weingart@cvs.openbsd.org>1997-03-31 04:20:09 +0000
commit86c7ba7f653f927f6ed0e92438088ba56f2782f1 (patch)
treebbbcab1c13db4096efde78637532ddd8bba0b2a8
parentdb37cd8003c371210064ba9f9a9c279f13a175d2 (diff)
Fix symbol handling (stripped kernels)
-rw-r--r--sys/lib/libsa/exec.c51
1 files changed, 28 insertions, 23 deletions
diff --git a/sys/lib/libsa/exec.c b/sys/lib/libsa/exec.c
index c6b05edd96f..c712720d652 100644
--- a/sys/lib/libsa/exec.c
+++ b/sys/lib/libsa/exec.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: exec.c,v 1.12 1997/03/30 20:13:04 mickey Exp $ */
+/* $OpenBSD: exec.c,v 1.13 1997/03/31 04:20:08 weingart Exp $ */
/* $NetBSD: exec.c,v 1.15 1996/10/13 02:29:01 christos Exp $ */
/*-
@@ -53,13 +53,13 @@ exec(path, loadaddr, howto)
void *loadaddr;
int howto;
{
- register int io;
+ int io;
#ifndef INSECURE
struct stat sb;
#endif
struct exec x;
int i;
- register char *addr;
+ char *addr;
#ifdef EXEC_DEBUG
char *daddr, *etxt;
#endif
@@ -127,29 +127,34 @@ exec(path, loadaddr, howto)
*addr++ = 0;
/* Symbols */
- ssym = addr;
- bcopy(&x.a_syms, addr, sizeof(x.a_syms));
- addr += sizeof(x.a_syms);
- printf("+[%ld", x.a_syms);
- if (read(io, addr, x.a_syms) != x.a_syms)
- goto shread;
- addr += x.a_syms;
-
- if (read(io, &i, sizeof(int)) != sizeof(int))
- goto shread;
-
- bcopy(&i, addr, sizeof(int));
- if (i) {
- i -= sizeof(int);
- addr += sizeof(int);
- if (read(io, addr, i) != i)
+ if(x.a_syms){
+ ssym = addr;
+ bcopy(&x.a_syms, addr, sizeof(x.a_syms));
+ addr += sizeof(x.a_syms);
+ printf("+[%ld", x.a_syms);
+ if (read(io, addr, x.a_syms) != x.a_syms)
+ goto shread;
+ addr += x.a_syms;
+
+ if (read(io, &i, sizeof(int)) != sizeof(int))
+ goto shread;
+
+ bcopy(&i, addr, sizeof(int));
+ if (i) {
+ i -= sizeof(int);
+ addr += sizeof(int);
+ if (read(io, addr, i) != i)
goto shread;
- addr += i;
+ addr += i;
+ }
+
+ /* and that many bytes of string table */
+ printf("+%d]", i);
+ }else{
+ ssym = 0;
+ esym = 0;
}
- /* and that many bytes of string table */
- printf("+%d]", i);
-
close(io);
#define round_to_size(x) \