svn commit: r274127 - head/sys/boot/common

Marcel Moolenaar marcel at FreeBSD.org
Wed Nov 5 04:18:42 UTC 2014


Author: marcel
Date: Wed Nov  5 04:18:41 2014
New Revision: 274127
URL: https://svnweb.freebsd.org/changeset/base/274127

Log:
  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.

Modified:
  head/sys/boot/common/misc.c

Modified: head/sys/boot/common/misc.c
==============================================================================
--- head/sys/boot/common/misc.c	Wed Nov  5 04:09:10 2014	(r274126)
+++ head/sys/boot/common/misc.c	Wed Nov  5 04:18:41 2014	(r274127)
@@ -121,12 +121,16 @@ kern_pread(int fd, vm_offset_t dest, siz
 	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 le
 
 	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);
 	}


More information about the svn-src-head mailing list