Solaris: Give better error on realloc failure
authorAlan Coopersmith <alan.coopersmith@oracle.com>
Wed, 5 Oct 2011 04:46:05 +0000 (21:46 -0700)
committerAlan Coopersmith <alan.coopersmith@oracle.com>
Sat, 15 Oct 2011 00:34:35 +0000 (17:34 -0700)
commit a18460b385ae03 converted from a fixed maximum number of devices
to dynamically growing the list via realloc, but didn't update the
error message shown on failure.

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Reviewed-by: Dirk Wallenstein <halsmit@t-online.de>
Reviewed-by: Mark Kettenis <kettenis@openbsd.org>
src/solx_devfs.c

index d47a846..ea91479 100644 (file)
@@ -454,8 +454,9 @@ probe_dev(nexus_t *nexus, pcitool_reg_t *prg_p, probe_info_t *pinfo)
                        new_num_elems * sizeof (struct pci_device_private));
                if (new_devs == NULL) {
                    (void) fprintf(stderr,
-                                  "Maximum number of PCI devices found,"
-                                  " discarding additional devices\n");
+                                  "Error allocating memory for PCI devices:"
+                                  " %s\n discarding additional devices\n",
+                                  strerror(errno));
                    return (rval);
                }
                (void) memset(&new_devs[pinfo->num_devices], 0,