From: Ben Pfaff Date: Mon, 2 Mar 2009 18:35:18 +0000 (-0800) Subject: netdev: Set *flagsp to 0 if flags cannot be obtained. X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f1de1b9b293b2c970afe84e505bbd114f1fd5832;p=openvswitch netdev: Set *flagsp to 0 if flags cannot be obtained. This interface is more convenient for some clients. --- diff --git a/lib/netdev.c b/lib/netdev.c index de8ee621..113b8471 100644 --- a/lib/netdev.c +++ b/lib/netdev.c @@ -825,7 +825,8 @@ netdev_get_in6(const struct netdev *netdev, struct in6_addr *in6) } /* 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) { @@ -1023,7 +1024,7 @@ netdev_enumerate(struct svec *svec) /* 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(). */ @@ -1034,12 +1035,12 @@ netdev_nodev_get_flags(const char *netdev_name, enum netdev_flags *flagsp) init_netdev(); + *flagsp = 0; error = get_flags(netdev_name, &flags); if (error) { return error; } - *flagsp = 0; if (flags & IFF_UP) { *flagsp |= NETDEV_UP; }