This is the mail archive of the
mailing list for the glibc project.
Re: RFC: getifaddrs returns -1 with errno == 0, fix
- From: Alexandre Oliva <aoliva at redhat dot com>
- To: libc-alpha at sourceware dot org
- Date: Tue, 09 Dec 2014 16:03:54 -0200
- Subject: Re: RFC: getifaddrs returns -1 with errno == 0, fix
- Authentication-results: sourceware.org; auth=none
- References: <or4nhrsl7s dot fsf at livre dot home> <orwqmf3vu3 dot fsf at livre dot home>
On Sep 17, 2013, Alexandre Oliva <firstname.lastname@example.org> wrote:
>> It turned out that getifaddrs() was indeed returning -1 without setting
>> errno, because the buffer allocated by __netlink_request wasn't large
>> enough to hold the response. The received message was marked as
>> truncated, and we bailed out(_fail) without setting any errors.
>> Rather than just fail, I experimented with growing the buffer and
>> retrying. I found out I had to consume the rest of the response to the
>> earlier request first, so I grew the buffer by just the right amount,
>> and that worked fine.
> for ChangeLog
> * sysdeps/unix/sysv/linux/ifaddrs.c (__netlink_request): Grow
> buffer and retry when message is fragmented.
Alexandre Oliva, freedom fighter http://FSFLA.org/~lxoliva/
You must be the change you wish to see in the world. -- Gandhi
Be Free! -- http://FSFLA.org/ FSF Latin America board member
Free Software Evangelist|Red Hat Brasil GNU Toolchain Engineer