summaryrefslogtreecommitdiff
path: root/usr/src/lib
diff options
context:
space:
mode:
authoranbui <none@none>2007-11-21 12:49:29 -0800
committeranbui <none@none>2007-11-21 12:49:29 -0800
commit7561ff4732aefa5f7470ef474274befa0e924f4b (patch)
tree1a4a77c6a0b20854a0e8cae092292c6c8a7afdd6 /usr/src/lib
parent71e32251703c729dbbebef2101770135584fd8d4 (diff)
downloadillumos-gate-7561ff4732aefa5f7470ef474274befa0e924f4b.tar.gz
6619332 prtdiag runs out of file descriptors in large OPL system
Diffstat (limited to 'usr/src/lib')
-rw-r--r--usr/src/lib/libprtdiag_psr/sparc/opl/common/opl_picl.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/usr/src/lib/libprtdiag_psr/sparc/opl/common/opl_picl.c b/usr/src/lib/libprtdiag_psr/sparc/opl/common/opl_picl.c
index 89fbdd516c..58dc79f5c7 100644
--- a/usr/src/lib/libprtdiag_psr/sparc/opl/common/opl_picl.c
+++ b/usr/src/lib/libprtdiag_psr/sparc/opl/common/opl_picl.c
@@ -676,11 +676,13 @@ get_lane_width
cap_ptr = read_byte(fd, bus, dev, func, PCI_CONF_CAP_PTR, &ret);
if (ret != 0) {
/* ioctl failure */
+ close(fd);
return (PICL_FAILURE);
}
cap_reg = read_word(fd, bus, dev, func, cap_ptr, &ret);
if (ret != 0) {
/* ioctl failure */
+ close(fd);
return (PICL_FAILURE);
}
capid = cap_reg & PCI_CAP_MASK;
@@ -690,11 +692,13 @@ get_lane_width
link_cap = read_long(fd, bus, dev, func, cap_ptr +
PCIE_LINKCAP, &ret);
if (ret != 0) {
+ close(fd);
return (PICL_FAILURE);
}
link_status = read_word(fd, bus, dev, func,
cap_ptr + PCIE_LINKSTS, &ret);
if (ret != 0) {
+ close(fd);
return (PICL_FAILURE);
}
*actual = ((link_status >> PCI_LINK_SHIFT) &
@@ -712,6 +716,7 @@ get_lane_width
(fd, bus, dev, func, PCI_CONF_HEADER, &ret);
if (ret != 0) {
/* ioctl failure */
+ close(fd);
return (PICL_FAILURE);
}
if ((hdr_type & PCI_HEADER_TYPE_M) == PCI_HEADER_PPB) {
@@ -721,6 +726,7 @@ get_lane_width
cap_ptr + PCI_PCIX_SEC_STATUS, &ret);
if (ret != 0) {
/* ioctl failure */
+ close(fd);
return (PICL_FAILURE);
}
if (sec_status & PCI_SEC_133)
@@ -749,6 +755,7 @@ get_lane_width
cap_ptr + PCI_PCIX_STATUS, &ret);
if (ret != 0) {
/* ioctl failure */
+ close(fd);
return (PICL_FAILURE);
}
if (pcix_status &
@@ -768,11 +775,16 @@ get_lane_width
cap_reg = read_word(fd, bus, dev, func, cap_ptr, &ret);
if (ret != 0) {
/* ioctl failure */
+ close(fd);
return (PICL_FAILURE);
}
capid = cap_reg & PCI_CAP_MASK;
}
+ if (close(fd) == -1) {
+ return (PICL_FAILURE);
+ }
+
return (PICL_SUCCESS);
}