[PATCH:libpciaccess] Solaris: Give better error on realloc failure

Dirk Wallenstein halsmit at t-online.de
Wed Oct 5 00:03:41 PDT 2011


On Tue, Oct 04, 2011 at 10:53:20PM -0700, Alan Coopersmith wrote:
> 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 at oracle.com>
> ---
>  src/solx_devfs.c |    5 +++--
>  1 files changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/src/solx_devfs.c b/src/solx_devfs.c
> index d47a846..ea91479 100644
> --- a/src/solx_devfs.c
> +++ b/src/solx_devfs.c
> @@ -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,
> -- 
> 1.7.3.2
> 

Reviewed-by: Dirk Wallenstein <halsmit at t-online.de>

Is the initial space and lower case in the second line intentional?

-- 
Cheers,
  Dirk


More information about the xorg-devel mailing list