int netdev_set_ifindex(NetDev *netdev, sd_rtnl_message *message) {
uint16_t type;
const char *kind;
- char *received_kind;
- char *received_name;
+ const char *received_kind;
+ const char *received_name;
int r, ifindex;
assert(netdev);
assert(manager);
assert(filename);
- if (null_or_empty_path(filename)) {
- log_debug("skipping empty file: %s", filename);
- return 0;
- }
-
file = fopen(filename, "re");
if (!file) {
if (errno == ENOENT)
return -errno;
}
+ if (null_or_empty_fd(fileno(file))) {
+ log_debug("Skipping empty file: %s", filename);
+ return 0;
+ }
+
netdev = new0(NetDev, 1);
if (!netdev)
return log_oom();
r = config_parse(NULL, filename, file,
"Match\0NetDev\0VLAN\0MACVLAN\0VXLAN\0Tunnel\0Peer\0Tun\0Tap\0Bond\0",
config_item_perf_lookup, network_netdev_gperf_lookup,
- false, false, netdev);
- if (r < 0) {
- log_warning("Could not parse config file %s: %s", filename, strerror(-r));
+ false, false, true, netdev);
+ if (r < 0)
return r;
- }
/* skip out early if configuration does not match the environment */
if (net_match_config(NULL, NULL, NULL, NULL, NULL,
return 0;
if (!NETDEV_VTABLE(netdev)) {
- log_warning("NetDev with invalid Kind configured in %s. Igonring", filename);
+ log_warning("NetDev with invalid Kind configured in %s. Ignoring", filename);
return 0;
}