Hi,

On Wed, Aug 13, 2008 at 01:49:41PM +0200, zhengda wrote:
> Neal H. Walfield wrote:

>> Check if the result is != -1, not > 0, which has a different meaning.
>>
>>>>> +          if (__asprintf (&name, "%s/%d", sock_servs, domain) > 0)
>>>>> +              np = name;
>>   
> but it's still wrong that __asprintf returns 0 in my code, isn't it?

There is no way asprintf() could return 0 here. (Unless there is an
internal error, in which case we loose anyways...)

Thus the >0 instead of !=-1 test doesn't actually hurt in a technical
sense -- it just has no effect at all; and this is confusing IMHO.

-antrik-


Reply via email to