[Libguestfs] [PATCH libnbd v3 4/6] generator: Check that more parameters are not NULL

Laszlo Ersek lersek at redhat.com
Thu Sep 29 09:35:54 UTC 2022


On 09/29/22 00:14, Eric Blake wrote:
> On Wed, Sep 28, 2022 at 06:25:37PM +0100, Richard W.M. Jones wrote:
>> We previously checked only that String parameters are not NULL,
>> returning an error + EFAULT if so.
>>
>> However we did not check Bytes*, SockAddrAndLen, Path or StringList
>> parameters, also never NULL.  Be consistent about checks.
>>
>> Thanks: Eric Blake for help and an earlier version of the patch
>> ---
>>  generator/API.ml            | 7 +++++--
>>  generator/C.ml              | 7 ++++++-
>>  tests/errors-connect-null.c | 2 +-
>>  3 files changed, 12 insertions(+), 4 deletions(-)
>>
> 
>> +++ b/tests/errors-connect-null.c
>> @@ -78,7 +78,7 @@ main (int argc, char *argv[])
>>      exit (EXIT_FAILURE);
>>    }
>>    /* FIXME: If we add nonnull attributes, this might change to EFAULT */
>> -  check (EINVAL, "nbd_connect_command: ");
>> +  check (EFAULT, "nbd_connect_command: ");
> 
> The FIXME comment is now stale and can be removed.
> 
> With that fixed, this one looks good.

Acked-by: Laszlo Ersek <lersek at redhat.com>


> tests/opt-list-meta-queries.c has a similar FIXME from commit
> 05b274ef, but where I ripped out the code that was in the version of
> the patch I had posted to the mailing list when I ripped out the
> EFAULT handling.  Can be reinstated in a separate patch.
> 



More information about the Libguestfs mailing list