Hi,
On Mon, 2013-12-02 at 12:17 +0200, Jukka Rissanen wrote:
> On ma, 2013-12-02 at 11:00 +0200, Patrik Flykt wrote:
> > ---
> > gdhcp/client.c | 7 ++++---
> > 1 file changed, 4 insertions(+), 3 deletions(-)
> >
> > diff --git a/gdhcp/client.c b/gdhcp/client.c
> > index e6106d1..922be92 100644
> > --- a/gdhcp/client.c
> > +++ b/gdhcp/client.c
> > @@ -1207,7 +1207,7 @@ error:
> >
> > static int dhcp_l2_socket(int ifindex)
> > {
> > - int fd;
> > + int fd, err;
> > struct sockaddr_ll sock;
> >
> > /*
> > @@ -1258,7 +1258,7 @@ static int dhcp_l2_socket(int ifindex)
> >
> > fd = socket(PF_PACKET, SOCK_DGRAM | SOCK_CLOEXEC, htons(ETH_P_IP));
> > if (fd < 0)
> > - return fd;
> > + return -errno;
> >
> > if (SERVER_PORT == 67 && CLIENT_PORT == 68)
> > /* Use only if standard ports are in use */
> > @@ -1271,8 +1271,9 @@ static int dhcp_l2_socket(int ifindex)
> > sock.sll_ifindex = ifindex;
> >
> > if (bind(fd, (struct sockaddr *) &sock, sizeof(sock)) != 0) {
> > + err = -errno;
>
> This could still be optimized by
>
> int err = -errno;
>
> that way no need to set the err at the beginning of the func.
Ok, I'll do that.
Cheers,
Patrik
_______________________________________________
connman mailing list
[email protected]
https://lists.connman.net/mailman/listinfo/connman