[systemd-devel] [PATCH 2/3] net-util: call ioctl() only if necessary

Lennart Poettering lennart at poettering.net
Thu Nov 7 13:29:54 PST 2013


On Wed, 06.11.13 11:18, Michal Sekletar (msekleta at redhat.com) wrote:

> In case when update of current values is not necessary we still might end up
> calling ioctl(), because need_update variable is not explicitly
> initialized.

Thanks! Applied!

> ---
>  src/udev/net/ethtool-util.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/src/udev/net/ethtool-util.c b/src/udev/net/ethtool-util.c
> index 68ddd25..c644f91 100644
> --- a/src/udev/net/ethtool-util.c
> +++ b/src/udev/net/ethtool-util.c
> @@ -67,7 +67,7 @@ int ethtool_set_speed(int fd, const char *ifname, unsigned int speed, Duplex dup
>  {
>          struct ifreq ifr;
>          struct ethtool_cmd ecmd;
> -        bool need_update;
> +        bool need_update = false;
>          int r;
>  
>          if (speed == 0 && duplex == _DUP_INVALID)
> @@ -120,7 +120,7 @@ int ethtool_set_speed(int fd, const char *ifname, unsigned int speed, Duplex dup
>  int ethtool_set_wol(int fd, const char *ifname, WakeOnLan wol) {
>          struct ifreq ifr;
>          struct ethtool_wolinfo ecmd;
> -        bool need_update;
> +        bool need_update = false;
>          int r;
>  
>          if (wol == _WOL_INVALID)


Lennart

-- 
Lennart Poettering, Red Hat


More information about the systemd-devel mailing list