From: Michal Sekletar Date: Wed, 6 Nov 2013 10:18:01 +0000 (+0100) Subject: net-util: call ioctl() only if necessary X-Git-Tag: v209~1527 X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?p=elogind.git;a=commitdiff_plain;h=0a2c2294265d1d4552af3e7a92df0d4560deb818;hp=47c649b5de480b832bb11e0d52ba58d962d61fb2;ds=sidebyside net-util: call ioctl() only if necessary 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. --- diff --git a/src/udev/net/ethtool-util.c b/src/udev/net/ethtool-util.c index 68ddd25a9..c644f91d0 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)