diff options
author | Zachary Ware <zachary.ware@gmail.com> | 2015-05-18 05:47:15 (GMT) |
---|---|---|
committer | Zachary Ware <zachary.ware@gmail.com> | 2015-05-18 05:47:15 (GMT) |
commit | 0a29e898cd9f8ca49008baba8e739422fd9276a8 (patch) | |
tree | 154a862658202ebcd276d68ec856700ef9334f06 /PC/_msi.c | |
parent | 610a51f364f6cb5ffb5167d9bf4dcecc1815107c (diff) | |
download | cpython-0a29e898cd9f8ca49008baba8e739422fd9276a8.zip cpython-0a29e898cd9f8ca49008baba8e739422fd9276a8.tar.gz cpython-0a29e898cd9f8ca49008baba8e739422fd9276a8.tar.bz2 |
Issue #21931: Fix error handling in msilib.FCICreate().
Patch by Jeffrey Armstrong.
Diffstat (limited to 'PC/_msi.c')
-rw-r--r-- | PC/_msi.c | 15 |
1 files changed, 12 insertions, 3 deletions
@@ -243,8 +243,13 @@ static PyObject* fcicreate(PyObject* obj, PyObject* args) for (i=0; i < PyList_GET_SIZE(files); i++) { PyObject *item = PyList_GET_ITEM(files, i); char *filename, *cabname; - if (!PyArg_ParseTuple(item, "ss", &filename, &cabname)) - goto err; + + if (!PyArg_ParseTuple(item, "ss", &filename, &cabname)) { + PyErr_SetString(PyExc_TypeError, "FCICreate expects a list of tuples containing two strings"); + FCIDestroy(hfci); + return NULL; + } + if (!FCIAddFile(hfci, filename, cabname, FALSE, cb_getnextcabinet, cb_status, cb_getopeninfo, tcompTYPE_MSZIP)) @@ -260,7 +265,11 @@ static PyObject* fcicreate(PyObject* obj, PyObject* args) Py_INCREF(Py_None); return Py_None; err: - PyErr_Format(PyExc_ValueError, "FCI error %d", erf.erfOper); /* XXX better error type */ + if(erf.fError) + PyErr_Format(PyExc_ValueError, "FCI error %d", erf.erfOper); /* XXX better error type */ + else + PyErr_SetString(PyExc_ValueError, "FCI general error"); + FCIDestroy(hfci); return NULL; } |