summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authornima <nima@abc39116-655e-4be6-ad55-d661dc543056>2008-12-19 13:49:19 +0000
committernima <nima@abc39116-655e-4be6-ad55-d661dc543056>2008-12-19 13:49:19 +0000
commitea6e33f5a11185286c464305f6ef408ff8ff8b93 (patch)
tree4c07efe0b9bf1e787ad619d56aeaacf91637b16c /src
parentef62ae6dea3de725825a92e92bfab6cb9a581f93 (diff)
downloadpython-dmidecode-ea6e33f5a11185286c464305f6ef408ff8ff8b93.tar.gz
python-dmidecode-ea6e33f5a11185286c464305f6ef408ff8ff8b93.tar.xz
python-dmidecode-ea6e33f5a11185286c464305f6ef408ff8ff8b93.zip
More testing and fixes.
git-svn-id: svn://svn.autonomy.net.au/python-dmidecode@127 abc39116-655e-4be6-ad55-d661dc543056
Diffstat (limited to 'src')
-rw-r--r--src/dmidecodemodule.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/dmidecodemodule.c b/src/dmidecodemodule.c
index 3214308..e873c6c 100644
--- a/src/dmidecodemodule.c
+++ b/src/dmidecodemodule.c
@@ -157,9 +157,13 @@ static PyObject* dmidecode_get_type(PyObject *self, PyObject *args) {
return Py_None;
}
-static PyObject* dmidecode_dump(PyObject *self, PyObject *args) {
- const char *f = PyString_AsString(opt.dumpfile);
- if((access(f, F_OK) != 0) || (access(f, W_OK) == 0))
+static PyObject* dmidecode_dump(PyObject *self, PyObject *null) {
+ const char *f;
+ f = opt.dumpfile ? PyString_AsString(opt.dumpfile) : opt.devmem;
+ struct stat buf;
+ stat(f, &buf);
+
+ if((access(f, F_OK) != 0) || ((access(f, W_OK) == 0) && S_ISREG(buf.st_mode)))
if(dump(PyString_AS_STRING(opt.dumpfile)))
Py_RETURN_TRUE;
Py_RETURN_FALSE;