public inbox for linux-man@vger.kernel.org
 help / color / mirror / Atom feed
From: Simon Paillard <simon.paillard-RGJHTEmuthQGuQl/6FzYuenJ6Cvpl5oe@public.gmane.org>
To: Adrian Dabrowski
	<atrox-qE3U7d0pukyEhLc4KmoMIOTv7YV0F9Eg@public.gmane.org>
Cc: mtk.manpages-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org,
	linux-man-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: Re: getifaddrs()
Date: Fri, 6 Jul 2012 21:29:45 +0200	[thread overview]
Message-ID: <20120706192945.GA15283@glenfiddich.mraw.org> (raw)
In-Reply-To: <4FF60812.70408-qE3U7d0pukyEhLc4KmoMIOTv7YV0F9Eg@public.gmane.org>

Hi,

On Thu, Jul 05, 2012 at 11:33:06PM +0200, Adrian Dabrowski wrote:
> Version: manpages-dev 3.27-1ubuntu2

You should upgrade your manpages-dev version:
http://packages.ubuntu.com/search?keywords=manpages-dev 
 
> The example program source produces a Seg-Fault, when a device does
> not have an ifa->ifa_addr. (e.g. openvpn-tunnels, probably others
> (dialup?))

Thanks for reporting the issue, don't hesitate to report similar reports *that
still apply in current version*.
 
> ORIGINAL:
>            for (ifa = ifaddr; ifa != NULL; ifa = ifa->ifa_next) {
>                family = ifa->ifa_addr->sa_family;

http://man7.org/linux/man-pages/man3/getifaddrs.3.html

           for (ifa = ifaddr; ifa != NULL; ifa = ifa->ifa_next) {
               if (ifa->ifa_addr == NULL)
                   continue;

               family = ifa->ifa_addr->sa_family; 

It has been fixed by
http://git.kernel.org/?p=docs/man-pages/man-pages.git;a=commitdiff;h=ebd05fecfe

> POSSIBLE FIX:
>            for (ifa = ifaddr; ifa != NULL; ifa = ifa->ifa_next) {
> 		if (ifa->ifa_addr != NULL)
>                		family = ifa->ifa_addr->sa_family;
> 		else
> 			family = -1;
> 
> 
> Also it is not documented, that  struct sockaddr *ifa_addr  might be NULL.


Best regards.

-- 
Simon Paillard
--
To unsubscribe from this list: send the line "unsubscribe linux-man" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

  parent reply	other threads:[~2012-07-06 19:29 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-07-05 21:33 getifaddrs() Adrian Dabrowski
     [not found] ` <4FF60812.70408-qE3U7d0pukyEhLc4KmoMIOTv7YV0F9Eg@public.gmane.org>
2012-07-06 19:29   ` Simon Paillard [this message]
     [not found]     ` <20120706192945.GA15283-8MNqHwMchPhGJ/Ie3qa20WD2FQJk+8+b@public.gmane.org>
2012-07-07  6:20       ` getifaddrs() Michael Kerrisk (man-pages)

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20120706192945.GA15283@glenfiddich.mraw.org \
    --to=simon.paillard-rgjhtemuthqguql/6fzyuenj6cvpl5oe@public.gmane.org \
    --cc=atrox-qE3U7d0pukyEhLc4KmoMIOTv7YV0F9Eg@public.gmane.org \
    --cc=linux-man-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=mtk.manpages-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox