From: Justin Pettit <jpettit@nicira.com>
Date: Wed, 23 Feb 2011 18:39:21 +0000 (-0800)
Subject: ovsdb: Warn when result of ovsdb_txn_commit() is ignored and fix caller.
X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5f8e32136eacbc91b7422b17d8208a64cfb3b8b9;p=openvswitch

ovsdb: Warn when result of ovsdb_txn_commit() is ignored and fix caller.

ovsdb_txn_commit() may return a ovsdb_error structure, which should be
freed by the caller.  The only remaining caller that discards the result
is in ovsdb_file_open__(), which this fixes.

Suggested-by: Ben Pfaff <blp@nicira.com>
---

diff --git a/ovsdb/file.c b/ovsdb/file.c
index bf72316c..9f0ab280 100644
--- a/ovsdb/file.c
+++ b/ovsdb/file.c
@@ -223,7 +223,7 @@ ovsdb_file_open__(const char *file_name,
             oldest_commit = date;
         }
 
-        ovsdb_txn_commit(txn, false);
+        ovsdb_error_destroy(ovsdb_txn_commit(txn, false));
     }
     if (error) {
         /* Log error but otherwise ignore it.  Probably the database just got
diff --git a/ovsdb/transaction.h b/ovsdb/transaction.h
index 414b358b..1d03ebda 100644
--- a/ovsdb/transaction.h
+++ b/ovsdb/transaction.h
@@ -26,7 +26,8 @@ struct uuid;
 
 struct ovsdb_txn *ovsdb_txn_create(struct ovsdb *);
 void ovsdb_txn_abort(struct ovsdb_txn *);
-struct ovsdb_error *ovsdb_txn_commit(struct ovsdb_txn *, bool durable);
+struct ovsdb_error *ovsdb_txn_commit(struct ovsdb_txn *, bool durable)
+    WARN_UNUSED_RESULT;
 
 struct ovsdb_row *ovsdb_txn_row_modify(struct ovsdb_txn *,
                                        const struct ovsdb_row *);