diff options
| author | Michael Vogt <michael.vogt@ubuntu.com> | 2008-07-31 12:01:43 +0200 |
|---|---|---|
| committer | Michael Vogt <michael.vogt@ubuntu.com> | 2008-07-31 12:01:43 +0200 |
| commit | 19fdcab7acc03ceb6aaf57f7ccdd754a41aa7b6e (patch) | |
| tree | 71306cb8396e4e5959600ada70cb149df8b1a8f6 /python | |
| parent | b4d0f3a1c38d916c2abda67549a454467a05fb1f (diff) | |
| download | python-apt-19fdcab7acc03ceb6aaf57f7ccdd754a41aa7b6e.tar.gz | |
* python/apt_instmodule.cc:
- do not change working dir in debExtractArchive() (LP: #184093)
Diffstat (limited to 'python')
| -rw-r--r-- | python/apt_instmodule.cc | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/python/apt_instmodule.cc b/python/apt_instmodule.cc index 43d5e7f7..6e6c89dd 100644 --- a/python/apt_instmodule.cc +++ b/python/apt_instmodule.cc @@ -74,6 +74,7 @@ static char *doc_debExtractArchive = static PyObject *debExtractArchive(PyObject *Self,PyObject *Args) { char *Rootdir = NULL; + char cwd[512]; PyObject *File; if (PyArg_ParseTuple(Args,"O!|s",&PyFile_Type,&File,&Rootdir) == 0) return 0; @@ -83,21 +84,27 @@ static PyObject *debExtractArchive(PyObject *Self,PyObject *Args) { if(Rootdir != NULL) { + getcwd(cwd, sizeof(cwd)); chdir(Rootdir); } // Open the file and associate the .deb FileFd Fd(fileno(PyFile_AsFile(File)),false); debDebFile Deb(Fd); - if (_error->PendingError() == true) - return HandleErrors(); + if (_error->PendingError() == true) { + if (cwd != NULL) + chdir (cwd); + return HandleErrors(Py_BuildValue("b",false)); + } // extracts relative to the current dir pkgDirStream Extract; res = Deb.ExtractArchive(Extract); + if (cwd != NULL) + chdir (cwd); if (res == false) - return HandleErrors(); + return HandleErrors(Py_BuildValue("b",res)); } return HandleErrors(Py_BuildValue("b",res)); } |
