summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authornima <nima@abc39116-655e-4be6-ad55-d661dc543056>2008-10-18 09:28:46 +0000
committernima <nima@abc39116-655e-4be6-ad55-d661dc543056>2008-10-18 09:28:46 +0000
commit4c92ab9878eaff844316e8f416a3bb59c5c9df46 (patch)
tree28d370f7df428a278dbf0f17275c65cef22c358f
parent259d4088f61379786d1889c2e5bc7df2687ea6c3 (diff)
downloadpython-dmidecode-4c92ab9878eaff844316e8f416a3bb59c5c9df46.tar.gz
python-dmidecode-4c92ab9878eaff844316e8f416a3bb59c5c9df46.tar.xz
python-dmidecode-4c92ab9878eaff844316e8f416a3bb59c5c9df46.zip
Fixed bug reported by by Justin Cook, where dmidecode.type() would segfault.
It turned out to be some code that was forgotten about during the conversion, or at least very incomplete and wrong. git-svn-id: svn://svn.autonomy.net.au/python-dmidecode@71 abc39116-655e-4be6-ad55-d661dc543056
-rw-r--r--dmidecodemodule.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/dmidecodemodule.c b/dmidecodemodule.c
index 6e9cfe5..57b499a 100644
--- a/dmidecodemodule.c
+++ b/dmidecodemodule.c
@@ -121,8 +121,10 @@ static PyObject* dmidecode_get_cache(PyObject *self, PyObject *args) { return dm
static PyObject* dmidecode_get_connector(PyObject *self, PyObject *args) { return dmidecode_get(self, "connector"); }
static PyObject* dmidecode_get_slot(PyObject *self, PyObject *args) { return dmidecode_get(self, "slot"); }
static PyObject* dmidecode_get_type(PyObject *self, PyObject *args) {
- fprintf(stderr, "%s\n", PyString_AsString(args));
- return dmidecode_get(self, PyString_AsString(args));
+ const char *s;
+ if(PyArg_ParseTuple(args, "s", &s)) {
+ return dmidecode_get(self, s);
+ }
}
PyMethodDef DMIDataMethods[] = {