Re: [PATCH v1 01/37] viralloc: Report OOM error on failure

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 07/04/2013 08:06 AM, Michal Privoznik wrote:
>  virInsertElementsN(void *ptrptr, size_t size, size_t at,
>                     size_t *countptr,
>                     size_t add, void *newelems,
> -                   bool clearOriginal, bool inPlace)
> +                   bool clearOriginal, bool inPlace,
> +                   bool report,
> +                   int domcode,
> +                   const char *filename,
> +                   const char *funcname,
> +                   size_t linenr)
>  {
>      if (at == -1) {
>          at = *countptr;
>      } else if (at > *countptr) {
> -        VIR_WARN("out of bounds index - count %zu at %zu add %zu",
> -                 *countptr, at, add);
> +        virReportError(VIR_ERR_INTERNAL_ERROR,
> +                       _("out of bounds index - count %zu at %zu add %zu"),
> +                       *countptr, at, add);
>          return -1;

If this happens and "report" is set to True, the caller will also report
the error (but as OOM), overwriting this one.

I don't really have a suggestion for a better way to handle it, just
thought I'd point it out (that's why it was a VIR_WARN, but in the end
that's really no better, since again the error code in the API would
come from the caller, and in both cases the system logs would contain
both the "out of bounds" message and the "out of memory" message).


--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]