Blame SOURCES/fix-missing-error-checking-when-reading-proc-net-dev.patch

9ab2b2
From f8b0e05c03add3d0bd7736c3e3f81e8eb28bc7c3 Mon Sep 17 00:00:00 2001
9ab2b2
From: David Sommerseth <davids@redhat.com>
9ab2b2
Date: Fri, 13 Sep 2013 18:54:05 +0200
9ab2b2
Subject: [PATCH] Fix missing error checking when reading /proc/net/dev
9ab2b2
9ab2b2
Signed-off-by: David Sommerseth <davids@redhat.com>
9ab2b2
---
9ab2b2
 python-ethtool/ethtool.c | 10 ++++++++--
9ab2b2
 1 file changed, 8 insertions(+), 2 deletions(-)
9ab2b2
9ab2b2
diff --git a/python-ethtool/ethtool.c b/python-ethtool/ethtool.c
9ab2b2
index e58d5f9..a471726 100644
9ab2b2
--- a/python-ethtool/ethtool.c
9ab2b2
+++ b/python-ethtool/ethtool.c
9ab2b2
@@ -80,7 +80,7 @@ static PyObject *get_active_devices(PyObject *self __unused, PyObject *args __un
9ab2b2
 static PyObject *get_devices(PyObject *self __unused, PyObject *args __unused)
9ab2b2
 {
9ab2b2
 	char buffer[256];
9ab2b2
-	char *ret;;
9ab2b2
+	char *ret;
9ab2b2
 	PyObject *list = PyList_New(0);
9ab2b2
 	FILE *fd = fopen(_PATH_PROCNET_DEV, "r");
9ab2b2
 
9ab2b2
@@ -89,7 +89,13 @@ static PyObject *get_devices(PyObject *self __unused, PyObject *args __unused)
9ab2b2
 		return NULL;
9ab2b2
 	}
9ab2b2
 	/* skip over first two lines */
9ab2b2
-	ret = fgets(buffer, 256, fd); ret = fgets(buffer, 256, fd);
9ab2b2
+	ret = fgets(buffer, 256, fd);
9ab2b2
+	ret = fgets(buffer, 256, fd);
9ab2b2
+	if( !ret ) {
9ab2b2
+		PyErr_SetString(PyExc_OSError, strerror(errno));
9ab2b2
+		return NULL;
9ab2b2
+	}
9ab2b2
+
9ab2b2
 	while (!feof(fd)) {
9ab2b2
 		PyObject *str;
9ab2b2
 		char *name = buffer;