chiark
/
gitweb
/
~ianmdlvl
/
elogind.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (from parent 1:
61f3af4
)
net: initialize structs when declaring
author
Tom Gundersen
<teg@jklm.no>
Fri, 21 Feb 2014 20:32:38 +0000
(21:32 +0100)
committer
Tom Gundersen
<teg@jklm.no>
Fri, 21 Feb 2014 20:32:38 +0000
(21:32 +0100)
src/udev/net/ethtool-util.c
patch
|
blob
|
history
diff --git
a/src/udev/net/ethtool-util.c
b/src/udev/net/ethtool-util.c
index 18d44fc9689631ae75c6ab7bb655c8b8c4301956..63465303231a3dfae0fb918bff710a4607980440 100644
(file)
--- a/
src/udev/net/ethtool-util.c
+++ b/
src/udev/net/ethtool-util.c
@@
-89,20
+89,19
@@
int ethtool_get_driver(int fd, const char *ifname, char **ret) {
int ethtool_set_speed(int fd, const char *ifname, unsigned int speed, Duplex duplex)
{
int ethtool_set_speed(int fd, const char *ifname, unsigned int speed, Duplex duplex)
{
- struct ifreq ifr;
- struct ethtool_cmd ecmd;
+ struct ethtool_cmd ecmd = {
+ .cmd = ETHTOOL_GSET
+ };
+ struct ifreq ifr = {
+ .ifr_data = (void*) &ecmd
+ };
bool need_update = false;
int r;
if (speed == 0 && duplex == _DUP_INVALID)
return 0;
bool need_update = false;
int r;
if (speed == 0 && duplex == _DUP_INVALID)
return 0;
- zero(ecmd);
- ecmd.cmd = ETHTOOL_GSET;
-
- zero(ifr);
strscpy(ifr.ifr_name, IFNAMSIZ, ifname);
strscpy(ifr.ifr_name, IFNAMSIZ, ifname);
- ifr.ifr_data = (void *)&ecmd;
r = ioctl(fd, SIOCETHTOOL, &ifr);
if (r < 0)
r = ioctl(fd, SIOCETHTOOL, &ifr);
if (r < 0)
@@
-142,20
+141,19
@@
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) {
}
int ethtool_set_wol(int fd, const char *ifname, WakeOnLan wol) {
- struct ifreq ifr;
- struct ethtool_wolinfo ecmd;
+ struct ethtool_wolinfo ecmd = {
+ .cmd = ETHTOOL_GWOL
+ };
+ struct ifreq ifr = {
+ .ifr_data = (void*) &ecmd
+ };
bool need_update = false;
int r;
if (wol == _WOL_INVALID)
return 0;
bool need_update = false;
int r;
if (wol == _WOL_INVALID)
return 0;
- zero(ecmd);
- ecmd.cmd = ETHTOOL_GWOL;
-
- zero(ifr);
strscpy(ifr.ifr_name, IFNAMSIZ, ifname);
strscpy(ifr.ifr_name, IFNAMSIZ, ifname);
- ifr.ifr_data = (void *)&ecmd;
r = ioctl(fd, SIOCETHTOOL, &ifr);
if (r < 0)
r = ioctl(fd, SIOCETHTOOL, &ifr);
if (r < 0)