[systemd-devel] [PATCH 12/24] sd-dhcp6-client: Add DHCPv6 Solicit message creation and sending
Zbigniew Jędrzejewski-Szmek
zbyszek at in.waw.pl
Thu Jun 19 05:35:57 PDT 2014
On Thu, Jun 19, 2014 at 02:52:06PM +0300, Patrik Flykt wrote:
> On Wed, 2014-06-18 at 16:25 +0200, Zbigniew Jędrzejewski-Szmek wrote:
> > On Wed, Jun 18, 2014 at 07:05:35AM -0700, Filipe Brandenburger wrote:
> > > On Wed, Jun 18, 2014 at 6:58 AM, Zbigniew Jędrzejewski-Szmek
> > > <zbyszek at in.waw.pl> wrote:
> > > >> + if (client->fd > 0)
> > > >> + safe_close(client->fd);
> > > >> + client->fd = -1;
> > > > client->fd = safe_close(client->fd);
> > > >
> > > > That's what safe_close is for :)
> > >
> > > And shouldn't the check be for client->fd >= 0? Zero is a valid file descriptor.
> > Yeah... but note that safe_close already has the fd >= 0 check, so the
> > replacement line replaces the if too.
>
> If I omit the client->fd > 0 check I get the following in the test case:
>
> Assertion 'close_nointr(fd) != -EBADF' failed at src/shared/util.c:205,
> function safe_close(). Aborting.
Hm, is client->fd == 0? Most likely this means that it needs to be initialized
to -1.
Zbyszek
More information about the systemd-devel
mailing list