[systemd-devel] [PATCH 02/11] libsystemd-dhcp: Return proper error if bind fails
Zbigniew Jędrzejewski-Szmek
zbyszek at in.waw.pl
Fri Dec 20 07:35:44 PST 2013
On Fri, Dec 20, 2013 at 05:16:11PM +0200, Patrik Flykt wrote:
> This also fixes a minor indentation damage.
> ---
> src/libsystemd-dhcp/dhcp-network.c | 7 ++++---
> 1 file changed, 4 insertions(+), 3 deletions(-)
>
> diff --git a/src/libsystemd-dhcp/dhcp-network.c b/src/libsystemd-dhcp/dhcp-network.c
> index 83a3084..3ff2d0b 100644
> --- a/src/libsystemd-dhcp/dhcp-network.c
> +++ b/src/libsystemd-dhcp/dhcp-network.c
> @@ -31,8 +31,8 @@
> #include "dhcp-internal.h"
>
> int dhcp_network_bind_raw_socket(int index, union sockaddr_union *link)
> - {
> - int s;
> +{
> + int s, err;
>
> s = socket(AF_PACKET, SOCK_DGRAM | SOCK_CLOEXEC | SOCK_NONBLOCK,
> htons(ETH_P_IP));
> @@ -46,8 +46,9 @@ int dhcp_network_bind_raw_socket(int index, union sockaddr_union *link)
> memset(link->ll.sll_addr, 0xff, ETH_ALEN);
>
> if (bind(s, &link->sa, sizeof(link->ll)) < 0) {
> + err = -errno;
> close(s);
> - return -errno;
> + return err;
'err' → 'r', for consistency with other code.
Zbyszek
More information about the systemd-devel
mailing list