}
/* Obtains the current flags for 'netdev' and stores them into '*flagsp'.
- * Returns 0 if successful, otherwise a positive errno value. */
+ * Returns 0 if successful, otherwise a positive errno value. On failure,
+ * stores 0 into '*flagsp'. */
int
netdev_get_flags(const struct netdev *netdev, enum netdev_flags *flagsp)
{
/* Obtains the current flags for the network device named 'netdev_name' and
* stores them into '*flagsp'. Returns 0 if successful, otherwise a positive
- * errno value.
+ * errno value. On error, stores 0 into '*flagsp'.
*
* If only device flags are needed, this is more efficient than calling
* netdev_open(), netdev_get_flags(), netdev_close(). */
init_netdev();
+ *flagsp = 0;
error = get_flags(netdev_name, &flags);
if (error) {
return error;
}
- *flagsp = 0;
if (flags & IFF_UP) {
*flagsp |= NETDEV_UP;
}