diff options
author | mikeh <mikeh@FreeBSD.org> | 2001-12-09 07:22:26 +0000 |
---|---|---|
committer | mikeh <mikeh@FreeBSD.org> | 2001-12-09 07:22:26 +0000 |
commit | 41747ff12401032e44ffdc7e1f4e5d5b052f7fde (patch) | |
tree | 56f9b9b43cab15d2c6660d2793d7217814286eae /usr.sbin | |
parent | 1c02062f9f182c9815e3025514e0c3baf8c0114c (diff) | |
download | FreeBSD-src-41747ff12401032e44ffdc7e1f4e5d5b052f7fde.zip FreeBSD-src-41747ff12401032e44ffdc7e1f4e5d5b052f7fde.tar.gz |
WARNS=2 cleanup.
PR: bin/32567
MFC after: 2 weeks
Diffstat (limited to 'usr.sbin')
-rw-r--r-- | usr.sbin/kldxref/Makefile | 2 | ||||
-rw-r--r-- | usr.sbin/kldxref/ef.c | 14 | ||||
-rw-r--r-- | usr.sbin/kldxref/kldxref.c | 3 |
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 |