diff options
author | Matt Wilson <msw@redhat.com> | 1999-08-07 20:39:42 +0000 |
---|---|---|
committer | Matt Wilson <msw@redhat.com> | 1999-08-07 20:39:42 +0000 |
commit | 4c9fe01e9831e55a69abd7395423e3e925dab160 (patch) | |
tree | 02d492282717e80dd374e053930dbf9580da3889 | |
parent | fe528ed46a55707e8be4dee426b8c96dbed55773 (diff) | |
download | anaconda-4c9fe01e9831e55a69abd7395423e3e925dab160.tar.gz anaconda-4c9fe01e9831e55a69abd7395423e3e925dab160.tar.xz anaconda-4c9fe01e9831e55a69abd7395423e3e925dab160.zip |
proper rpmmodule fd closes
-rw-r--r-- | rpmmodule/rpmmodule.c | 7 | ||||
-rw-r--r-- | todo.py | 10 |
2 files changed, 12 insertions, 5 deletions
diff --git a/rpmmodule/rpmmodule.c b/rpmmodule/rpmmodule.c index 6b8d8a463..5578483b2 100644 --- a/rpmmodule/rpmmodule.c +++ b/rpmmodule/rpmmodule.c @@ -910,7 +910,7 @@ static void * tsCallback(const Header h, const rpmCallbackType what, struct tsCallbackType * cbInfo = data; PyObject * args, * result; int fd; - FD_t fdt; + static FD_t fdt; if (cbInfo->pythonError) return NULL; @@ -931,11 +931,14 @@ static void * tsCallback(const Header h, const rpmCallbackType what, return NULL; } fdt = fdDup(fd); - close(fd); Py_DECREF(result); return fdt; } + if (what == RPMCALLBACK_INST_CLOSE_FILE) { + fdClose (fdt); + } + Py_DECREF(result); return NULL; @@ -341,6 +341,8 @@ class Authentication: class Drives: def available (self): return isys.hardDriveList () + +rpmFD = None class ToDo: def __init__(self, intf, method, rootPath, setupFilesystems = 1, @@ -613,12 +615,14 @@ class ToDo: intf.setPackage(h) intf.setPackageScale(0, 1) fn = method.getFilename(h) - instCallback.d = os.open(fn, os.O_RDONLY) - return instCallback.d + global rpmFD + rpmFD = os.open(fn, os.O_RDONLY) + return rpmFD elif (what == rpm.RPMCALLBACK_INST_PROGRESS): intf.setPackageScale(amount, total) elif (what == rpm.RPMCALLBACK_INST_CLOSE_FILE): - instCallback.d.close () + global rpmFD + os.close (rpmFD) (h, method) = key intf.completePackage(h) else: |