summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--usr.sbin/kldxref/Makefile2
-rw-r--r--usr.sbin/kldxref/ef.c14
-rw-r--r--usr.sbin/kldxref/kldxref.c3
3 files changed, 16 insertions, 3 deletions
diff --git a/usr.sbin/kldxref/Makefile b/usr.sbin/kldxref/Makefile
index 4bb374d..2afcf06 100644
--- a/usr.sbin/kldxref/Makefile
+++ b/usr.sbin/kldxref/Makefile
@@ -4,4 +4,6 @@ PROG= kldxref
SRCS= kldxref.c ef.c
MAN= kldxref.8
+WARNS?= 2
+
.include <bsd.prog.mk>
diff --git a/usr.sbin/kldxref/ef.c b/usr.sbin/kldxref/ef.c
index 9d3a478..8e8000b 100644
--- a/usr.sbin/kldxref/ef.c
+++ b/usr.sbin/kldxref/ef.c
@@ -49,6 +49,10 @@
#include "ef.h"
+static void ef_print_phdr(Elf_Phdr *);
+static u_long ef_get_offset(elf_file_t, Elf_Off);
+static int ef_parse_dynamic(elf_file_t);
+
void
ef_print_phdr(Elf_Phdr *phdr)
{
@@ -213,12 +217,18 @@ ef_parse_dynamic(elf_file_t ef)
int
ef_read(elf_file_t ef, Elf_Off offset, size_t len, void*dest)
{
+ ssize_t r;
- if (offset != -1) {
+ if (offset != (Elf_Off)-1) {
if (lseek(ef->ef_fd, offset, SEEK_SET) == -1)
return EIO;
}
- return read(ef->ef_fd, dest, len) == len ? 0 : EIO;
+
+ r = read(ef->ef_fd, dest, len);
+ if (r != -1 && (size_t)r == len)
+ return 0;
+ else
+ return EIO;
}
int
diff --git a/usr.sbin/kldxref/kldxref.c b/usr.sbin/kldxref/kldxref.c
index 79ab350..d572d14 100644
--- a/usr.sbin/kldxref/kldxref.c
+++ b/usr.sbin/kldxref/kldxref.c
@@ -81,11 +81,12 @@ static int dflag, verbose;
FILE *fxref;
-static char *xref_file = "linker.hints";
+static const char *xref_file = "linker.hints";
static char recbuf[MAXRECSIZE];
static int recpos, reccnt;
+void maketempfile(char *, const char *);
static void usage(void);
static void
OpenPOWER on IntegriCloud