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

Re: [Xen-devel] [PATCH 05/10] xl_cmdimpl: improve return codes for memset commands



On 01/04/16 15:33, Roger Pau Monné wrote:
> On Fri, 1 Apr 2016, Paulina Szubarczyk wrote:
> 
>>  - Use EXIT_{SUCCESS,FAILURE} for main_mem*() function
>>  - Use 0/1 as return values of set_memory_{max,target}
>>
>> Signed-off-by: Paulina Szubarczyk <paulinaszubarczyk@xxxxxxxxx>
>> ---
>>  tools/libxl/xl_cmdimpl.c | 24 ++++++++++++++++--------
>>  1 file changed, 16 insertions(+), 8 deletions(-)
>>
>> diff --git a/tools/libxl/xl_cmdimpl.c b/tools/libxl/xl_cmdimpl.c
>> index 7ee6953..31f037f 100644
>> --- a/tools/libxl/xl_cmdimpl.c
>> +++ b/tools/libxl/xl_cmdimpl.c
>> @@ -3380,15 +3380,15 @@ static int set_memory_max(uint32_t domid, const char 
>> *mem)
>>      memorykb = parse_mem_size_kb(mem);
>>      if (memorykb == -1) {
>>          fprintf(stderr, "invalid memory size: %s\n", mem);
>> -        exit(3);
>> +        exit(EXIT_FAILURE);
> 
> IMHO (I would like to hear others' opinion) but I think you can just 
> return 1 here instead of exiting.

I'm generally not in favor of non-top-level functions calling exit()
unless returning an error is really impossible (as libxl does with
memory allocation failures).

IOW, I tend to agree with Roger.

 -George


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.