Ignoring the result of this function means that the caller is quite likely
blindly using the character array passed in, instead of the return value,
which leads to latent bugs.

This would have prevented one of the bugs fixed by commit "tunneling: Fix a
tunnel name display bug".

CC: Andy Zhou <az...@nicira.com>
Signed-off-by: Ben Pfaff <b...@nicira.com>
---
This needs the patch from
        http://openvswitch.org/pipermail/dev/2015-June/055981.html
to be applied first, otherwise it adds a warning to the build.

 lib/netdev-vport.h | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/lib/netdev-vport.h b/lib/netdev-vport.h
index b20c407..be02cb5 100644
--- a/lib/netdev-vport.h
+++ b/lib/netdev-vport.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2010, 2011, 2013 Nicira, Inc.
+ * Copyright (c) 2010, 2011, 2013, 2015 Nicira, Inc.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -19,6 +19,7 @@
 
 #include <stdbool.h>
 #include <stddef.h>
+#include "compiler.h"
 
 struct dpif_netlink_vport;
 struct dpif_flow_stats;
@@ -48,7 +49,8 @@ enum { NETDEV_VPORT_NAME_BUFSIZE = 16 };
 enum { NETDEV_VPORT_NAME_BUFSIZE = 256 };
 #endif
 const char *netdev_vport_get_dpif_port(const struct netdev *,
-                                       char namebuf[], size_t bufsize);
+                                       char namebuf[], size_t bufsize)
+    OVS_WARN_UNUSED_RESULT;
 char *netdev_vport_get_dpif_port_strdup(const struct netdev *);
 
 #endif /* netdev-vport.h */
-- 
2.1.3

_______________________________________________
dev mailing list
dev@openvswitch.org
http://openvswitch.org/mailman/listinfo/dev

Reply via email to