aboutsummaryrefslogtreecommitdiff
path: root/usr.sbin/kldxref/ef.c
diff options
context:
space:
mode:
authorMike Heffner <mikeh@FreeBSD.org>2001-12-09 07:22:26 +0000
committerMike Heffner <mikeh@FreeBSD.org>2001-12-09 07:22:26 +0000
commit87e5cd7c1ab9ab0a75e0e24689f135cdfbdae104 (patch)
tree56f9b9b43cab15d2c6660d2793d7217814286eae /usr.sbin/kldxref/ef.c
parentffb6d5ad8fb57b85b3c849dbb8f67c8139369671 (diff)
downloadsrc-87e5cd7c1ab9ab0a75e0e24689f135cdfbdae104.tar.gz
src-87e5cd7c1ab9ab0a75e0e24689f135cdfbdae104.zip
WARNS=2 cleanup.
PR: bin/32567 MFC after: 2 weeks
Notes
Notes: svn path=/head/; revision=87551
Diffstat (limited to 'usr.sbin/kldxref/ef.c')
-rw-r--r--usr.sbin/kldxref/ef.c14
1 files changed, 12 insertions, 2 deletions
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