From 2eeaed14a5e2ed9bd811643ad5bffc3510ca0310 Mon Sep 17 00:00:00 2001 From: robj Date: Fri, 22 Feb 2008 15:04:09 -0800 Subject: PSARC 2008/091 Libtopo enumeration of fans and power supplies via IPMI 6614956 libimpi: add interfaces for accessing/decoding full and compact sensor data records 6641742 IPMI based libtopo enumeration of power supplies and fans 6643681 libtopo: need mechanism to register module methods on statically enumerated nodes 6653942 ::fmtopo prints garbage when dumping prop methods 6654386 libtopo: hc_enum double-populates authority pgroup on non-root nodes 6659015 ::topo_module dcmd can sigsegv 6661750 libtopo: need generic method to restrict both range/propgroup defs to specific platform in topo maps 6666459 libipmi: ILOM check could be more strict 6666469 libipmi should support reading SEL records 6666479 libipmi: need interface to get SP firmware version --- usr/src/lib/libipmi/common/libipmi.c | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) (limited to 'usr/src/lib/libipmi/common/libipmi.c') diff --git a/usr/src/lib/libipmi/common/libipmi.c b/usr/src/lib/libipmi/common/libipmi.c index 1aee67d245..def87d41cf 100644 --- a/usr/src/lib/libipmi/common/libipmi.c +++ b/usr/src/lib/libipmi/common/libipmi.c @@ -19,7 +19,7 @@ * CDDL HEADER END */ /* - * Copyright 2007 Sun Microsystems, Inc. All rights reserved. + * Copyright 2008 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -36,6 +36,7 @@ ipmi_handle_t * ipmi_open(int *errp, char **msg) { ipmi_handle_t *ihp; + static char errmsg[48]; if (msg) *msg = NULL; @@ -52,11 +53,13 @@ ipmi_open(int *errp, char **msg) ihp->ih_retries = 3; - if ((ihp->ih_tdata = ihp->ih_transport->it_open(ihp)) == NULL) { + if ((ihp->ih_tdata = ihp->ih_transport->it_open(ihp)) == NULL || + ipmi_sdr_init(ihp) != 0 || ipmi_entity_init(ihp) != 0) { *errp = ihp->ih_errno; if (msg) { - if ((*msg = strdup(ipmi_errmsg(ihp))) == NULL) - *msg = "memory allocation failure"; + (void) strncpy(errmsg, ipmi_errmsg(ihp), 47); + errmsg[47] = '\0'; + *msg = errmsg; } ipmi_close(ihp); return (NULL); @@ -70,8 +73,11 @@ ipmi_close(ipmi_handle_t *ihp) { if (ihp->ih_transport && ihp->ih_tdata) ihp->ih_transport->it_close(ihp->ih_tdata); - ipmi_sdr_clear(ihp); + ipmi_free(ihp, ihp->ih_deviceid); + ipmi_free(ihp, ihp->ih_firmware_rev); ipmi_user_clear(ihp); + ipmi_sdr_fini(ihp); + ipmi_entity_fini(ihp); free(ihp); } -- cgit v1.2.3