summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPanu Matilainen <pmatilai@redhat.com>2013-12-18 13:50:02 +0200
committerPanu Matilainen <pmatilai@redhat.com>2014-01-17 13:19:38 +0200
commit32747126b88942e02aa75f7c94c9961e2561b631 (patch)
treea42035f87c1cccf3daa26b1b1064b37894f4c1b4
parentbe27d2404b79b9426f0d183598487db93481f527 (diff)
downloadrpm-32747126b88942e02aa75f7c94c9961e2561b631.tar.gz
Support reopening an rpm.fd descriptor as well
(cherry picked from commit feafc9262e5b72ab9729937e687227dac4f556fe)
-rw-r--r--python/rpmfd-py.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/python/rpmfd-py.c b/python/rpmfd-py.c
index 788bdc887..cd93a3582 100644
--- a/python/rpmfd-py.c
+++ b/python/rpmfd-py.c
@@ -91,6 +91,9 @@ static int rpmfd_init(rpmfdObject *s, PyObject *args, PyObject *kwds)
fd = openPath(PyBytes_AsString(enc), rpmio_mode);
Py_DECREF(enc);
}
+ } else if (rpmfdObject_Check(fo)) {
+ rpmfdObject *fdo = (rpmfdObject *)fo;
+ fd = openFd(fdo->fd, rpmio_mode);
} else if ((fdno = PyObject_AsFileDescriptor(fo)) >= 0) {
fd = openFd(fdDup(fdno), rpmio_mode);
} else {