int do_hivex_commit (const char *filename) { CLEANUP_FREE char *buf = NULL; NEED_HANDLE (-1); /* The 'filename' parameter is an optional string, and in most * cases will be NULL. */ if (filename) { buf = sysroot_path (filename); if (!buf) { reply_with_perror ("malloc"); return -1; } if (hivex_commit (h, buf, 0) == -1) { reply_with_perror ("%s: commit failed", filename); return -1; } } else { if (hivex_commit (h, NULL, 0) == -1) { reply_with_perror ("commit failed"); return -1; } } return 0; }
static PyObject * py_hivex_commit (PyObject *self, PyObject *args) { PyObject *py_r; int r; hive_h *h; PyObject *py_h; char *filename; if (!PyArg_ParseTuple (args, (char *) "Oz:hivex_commit", &py_h, &filename)) return NULL; h = get_handle (py_h); r = hivex_commit (h, filename, 0); if (r == -1) { PyErr_SetString (PyExc_RuntimeError, strerror (errno)); return NULL; } Py_INCREF (Py_None); py_r = Py_None; return py_r; }