chiark
/
gitweb
/
~ianmdlvl
/
elogind.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
net-util: call ioctl() only if necessary
[elogind.git]
/
src
/
udev
/
net
/
ethtool-util.c
diff --git
a/src/udev/net/ethtool-util.c
b/src/udev/net/ethtool-util.c
index 4fad52b469f28c6ef3216ad726bec04dc6e9d586..c644f91d02d749b9e41f400ea411652a4390bf48 100644
(file)
--- a/
src/udev/net/ethtool-util.c
+++ b/
src/udev/net/ethtool-util.c
@@
-67,15
+67,16
@@
int ethtool_set_speed(int fd, const char *ifname, unsigned int speed, Duplex dup
{
struct ifreq ifr;
struct ethtool_cmd ecmd;
{
struct ifreq ifr;
struct ethtool_cmd ecmd;
- bool need_update;
+ bool need_update
= false
;
int r;
if (speed == 0 && duplex == _DUP_INVALID)
return 0;
int r;
if (speed == 0 && duplex == _DUP_INVALID)
return 0;
-
memset(&ecmd, 0x00, sizeof(struct ethtool_cmd)
);
+
zero(ecmd
);
ecmd.cmd = ETHTOOL_GSET;
ecmd.cmd = ETHTOOL_GSET;
- memset(&ifr, 0x00, sizeof(struct ifreq));
+
+ zero(ifr);
strscpy(ifr.ifr_name, IFNAMSIZ, ifname);
ifr.ifr_data = (void *)&ecmd;
strscpy(ifr.ifr_name, IFNAMSIZ, ifname);
ifr.ifr_data = (void *)&ecmd;
@@
-119,15
+120,16
@@
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;
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)
return 0;
int r;
if (wol == _WOL_INVALID)
return 0;
-
memset(&ecmd, 0x00, sizeof(struct ethtool_wolinfo)
);
+
zero(ecmd
);
ecmd.cmd = ETHTOOL_GWOL;
ecmd.cmd = ETHTOOL_GWOL;
- memset(&ifr, 0x00, sizeof(struct ifreq));
+
+ zero(ifr);
strscpy(ifr.ifr_name, IFNAMSIZ, ifname);
ifr.ifr_data = (void *)&ecmd;
strscpy(ifr.ifr_name, IFNAMSIZ, ifname);
ifr.ifr_data = (void *)&ecmd;