int rv, fd = socket (AF_UNIX, SOCK_DGRAM, 0);
struct ifreq ifr;
+ if (0 > fd)
+ {
+ clib_unix_warning ("af_packet_%s could not open socket",
+ apif->host_if_name);
+ return 0;
+ }
+
/* if interface is a bridge ignore */
if (apif->host_if_index < 0)
goto error; /* no error */
vnet_hw_interface_set_flags (vnm, hw_if_index, hw_flags);
error:
- close (fd);
+ if (0 <= fd)
+ close (fd);
return 0; /* no error */
}
int rv, fd = socket (AF_UNIX, SOCK_DGRAM, 0);
struct ifreq ifr;
+ if (0 > fd)
+ {
+ clib_unix_warning ("af_packet_%s could not open socket",
+ apif->host_if_name);
+ return 0;
+ }
+
/* if interface is a bridge ignore */
if (apif->host_if_index < 0)
goto error; /* no error */
}
error:
- close (fd);
+
+ if (0 <= fd)
+ close (fd);
return 0; /* no error */
}