chiark / gitweb /
net-util: call ioctl() only if necessary
authorMichal Sekletar <msekleta@redhat.com>
Wed, 6 Nov 2013 10:18:01 +0000 (11:18 +0100)
committerLennart Poettering <lennart@poettering.net>
Thu, 7 Nov 2013 21:25:42 +0000 (22:25 +0100)
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.

src/udev/net/ethtool-util.c

index 68ddd25a9068ebaf48fef3ac0c31885f3e0b1f60..c644f91d02d749b9e41f400ea411652a4390bf48 100644 (file)
@@ -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)