From 6da0fdade325c2ce0f371e661801e6beb1e70cdb Mon Sep 17 00:00:00 2001 From: Denys Vlasenko Date: Wed, 15 Dec 2010 18:33:43 +0100 Subject: python wrappers: make crash_data.create_crash_dump_dir() work Signed-off-by: Denys Vlasenko --- src/report-python/crash_dump.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) (limited to 'src/report-python/crash_dump.c') diff --git a/src/report-python/crash_dump.c b/src/report-python/crash_dump.c index c56db087..868e97ec 100644 --- a/src/report-python/crash_dump.c +++ b/src/report-python/crash_dump.c @@ -108,18 +108,22 @@ static PyObject *p_get_crash_data_item(PyObject *pself, PyObject *args) return Py_BuildValue("sI", ci->content, ci->flags); } +/* struct dump_dir *create_crash_dump_dir(crash_data_t *crash_data); */ static PyObject *p_create_crash_dump_dir(PyObject *pself, PyObject *args) { p_crash_data *self = (p_crash_data*)pself; + p_dump_dir *new_dd = PyObject_New(p_dump_dir, &p_dump_dir_type); + if (!new_dd) + return NULL; struct dump_dir *dd = create_crash_dump_dir(self->cd); - if (dd == NULL) + if (!dd) { + PyObject_Del((PyObject*)new_dd); PyErr_SetString(ReportError, "Can't create the dump dir"); return NULL; } - //FIXME: return a python representation of dump_dir, when we have it.. - dd_close(dd); - Py_RETURN_NONE; + new_dd->dd = dd; + return (PyObject*)new_dd; } //static PyMemberDef p_crash_data_members[] = { @@ -130,7 +134,7 @@ static PyMethodDef p_crash_data_methods[] = { { "add" , p_crash_data_add, METH_VARARGS, "Adds item to the crash data using default flags" }, { "add_ext" , p_crash_data_add_ext, METH_VARARGS, "Adds item to the crash data" }, { "get" , p_get_crash_data_item, METH_VARARGS, "Gets the value of item indexed by the key" }, - { "to_dump_dir", p_create_crash_dump_dir, METH_NOARGS, "Saves the crash_data to"LOCALSTATEDIR"/run/abrt/tmp--