From 41747ff12401032e44ffdc7e1f4e5d5b052f7fde Mon Sep 17 00:00:00 2001 From: mikeh Date: Sun, 9 Dec 2001 07:22:26 +0000 Subject: [PATCH] WARNS=2 cleanup. PR: bin/32567 MFC after: 2 weeks --- usr.sbin/kldxref/Makefile | 2 ++ usr.sbin/kldxref/ef.c | 14 ++++++++++++-- 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 4bb374d5d470..2afcf06763d8 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 diff --git a/usr.sbin/kldxref/ef.c b/usr.sbin/kldxref/ef.c index 9d3a478331f3..8e8000b3fd32 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 79ab350a7e78..d572d14abc45 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