From 1654a0462723b3b75d7a4a20bedfc653cc3e1f1a Mon Sep 17 00:00:00 2001
From: Alan Coopersmith <alan.coopersmith@oracle.com>
Date: Wed, 2 Jul 2014 16:41:10 -0700
Subject: [PATCH:libpciaccess] Solaris: Fix fd leak in
pci_device_solx_devfs_map_range()
Caching fd's for reuse is most effective when you actually stick the
newly opened fd in the cache, instead of letting it leak at the end
of the function.
Regression introduced by yours truly in commit 9f2d95e61896f41adb.
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Reviewed-by: Randy Fishel <randy.fishel@oracle.com>
---
src/solx_devfs.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/src/solx_devfs.c b/src/solx_devfs.c
index 8e7ea9b..f572393 100644
--- a/src/solx_devfs.c
+++ b/src/solx_devfs.c
@@ -724,6 +724,9 @@ pci_device_solx_devfs_map_range(struct pci_device *dev,
strerror(errno));
return err;
}
+#ifndef __sparc
+ xsvc_fd = map_fd;
+#endif
}
map->memory = mmap(NULL, map->size, prot, MAP_SHARED, map_fd, map->base);
--
1.7.9.2