Index: lib/ipmi_fru.c
===================================================================
RCS file: /cvsroot/ipmitool/ipmitool/lib/ipmi_fru.c,v
retrieving revision 1.72
diff -u -r1.72 ipmi_fru.c
--- lib/ipmi_fru.c	5 Mar 2013 05:00:32 -0000	1.72
+++ lib/ipmi_fru.c	8 Mar 2013 07:07:29 -0000
@@ -42,6 +42,7 @@
 #include <stdlib.h>
 #include <string.h>
 #include <time.h>
+#include <errno.h>
 
 #if HAVE_CONFIG_H
 # include <config.h>
@@ -3857,21 +3858,35 @@
 {
 	FILE * pFile;
 	uint32_t len = 0;
+	if (size < 0) {
+		return (-1);
+	}
+	if (pFileName == NULL) {
+		lprintf(LOG_ERR, "Invalid file name given.\n");
+		return (-1);
+	}
 
-	pFile = fopen(pFileName,"rb");
-	if (pFile) {
-		fseek(pFile, offset,SEEK_SET);
-		len = fread(pBufArea, size, 1, pFile);
-		fclose(pFile);
-	} else {
-		printf("Error opening file\n");
+	pFile = fopen(pFileName, "rb");
+	if (!pFile) {
+		lprintf(LOG_ERR, "Error opening file '%s'.\n", pFileName);
+		return (-1);
 	}
+	errno = 0;
+	if (fseek(pFile, offset, SEEK_SET) != 0) {
+		lprintf(LOG_ERR, "Failed to seek in file '%s': %i -> %s", pFileName, errno,
+				strerror(errno));
+		if (pFile) {
+			fclose(pFile);
+		}
+		return (-1);
+	}
+	len = fread(pBufArea, size, 1, pFile);
+	fclose(pFile);
 
 	if (len != 1) {
-		printf("Error with file %s\n", pFileName);
-		return -1;
+		lprintf(LOG_ERR, "Error in file '%s'.\n", pFileName);
+		return (-1);
 	}
-
 	return 0;
 }
 
