From 6d426c10fbb0975d2b9f62482b20f7068d1db810 Mon Sep 17 00:00:00 2001 From: Marcel Moolenaar Date: Wed, 5 Nov 2014 04:18:41 +0000 Subject: [PATCH] In alloc_pread() and kern_pread(), print errors only when DEBUG is defined. An error is not fatal and is supposed to be handled by the caller. Obtained from: Juniper Networks, Inc. --- sys/boot/common/misc.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/sys/boot/common/misc.c b/sys/boot/common/misc.c index c4c36ea9a4e..990df614fbe 100644 --- a/sys/boot/common/misc.c +++ b/sys/boot/common/misc.c @@ -121,12 +121,16 @@ kern_pread(int fd, vm_offset_t dest, size_t len, off_t off) ssize_t nread; if (lseek(fd, off, SEEK_SET) == -1) { +#ifdef DEBUG printf("\nlseek failed\n"); +#endif return (-1); } nread = archsw.arch_readin(fd, dest, len); if (nread != len) { +#ifdef DEBUG printf("\nreadin failed\n"); +#endif return (-1); } return (0); @@ -144,17 +148,23 @@ alloc_pread(int fd, off_t off, size_t len) buf = malloc(len); if (buf == NULL) { +#ifdef DEBUG printf("\nmalloc(%d) failed\n", (int)len); +#endif return (NULL); } if (lseek(fd, off, SEEK_SET) == -1) { +#ifdef DEBUG printf("\nlseek failed\n"); +#endif free(buf); return (NULL); } nread = read(fd, buf, len); if (nread != len) { +#ifdef DEBUG printf("\nread failed\n"); +#endif free(buf); return (NULL); }