bug-hurd
[Top][All Lists]
Advanced

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

Re: [PATCH,HURD] sendto: do not crash when addr is NULL


From: Roland McGrath
Subject: Re: [PATCH,HURD] sendto: do not crash when addr is NULL
Date: Mon, 21 May 2012 13:00:03 -0700 (PDT)

Put the name of a local variable in all caps when mentioning it in the log
entry or comments.

Initializing ERR at the top is confusingly subtle.
Instead, you make the code that actually cares look like:

        if (addr == NULL || addr->sun_family == AF_LOCAL)
          err = 0;
        else
          err = __socket_create_address (...);
        if (! err)
          ...

It looks like the existing code also has a leak of APORT in the case where
HURD_DPORT_USE fails (i.e. invalid fd).  So you should reorganize in some
way that fixes that too.

It might be simplest just to move the creation of the address port (both
the AF_LOCAL case and the default case) into a subroutine and just call
that inside HURD_DPORT_USE.  It means that the descriptor structure and
port are kept alive around the AF_LOCAL case's calls, but that seems OK.


Thanks,
Roland



reply via email to

[Prev in Thread] Current Thread [Next in Thread]