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

Re: [Xen-devel] [PATCH 3/8] tools/xenalyze: Handle fstat errors properly



On 26/02/16 12:25, Ian Jackson wrote:
> George Dunlap writes ("[PATCH 3/8] tools/xenalyze: Handle fstat errors 
> properly"):
>> They're pretty unlikely to fail, but doesn't hurt to check.
> ...
>> -    fstat(fd, &s);
>> +    if ( fstat(fd, &s) ) {
>> +        perror("fstat");
>> +        free(h);
>> +        h = NULL;
>> +        goto out;
>> +    }
> 
> Is there some reason why you're not calling exit ?  mread64 already
> does so on mmap failure.
> 
> For that matter, is error() not available in this file ?

I originally meant this to be library-like (a faster implementation of
pread actually).  So it doesn't have error(), and for consistency
probably shouldn't be calling exit() on mmap() failure.

Is there a reason not to just return null and let the caller figure out
what to do?

 -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®.