[tracker/wip/carlosg/coverity-fixes: 5/7] docs: Avoid dead expressions in code examples




commit f8282a29e5c3c750a5cb6979131d42c41c50abdc
Author: Carlos Garnacho <carlosg gnome org>
Date:   Mon Sep 7 18:14:21 2020 +0200

    docs: Avoid dead expressions in code examples
    
    Spotted by Coverity.
    
    CID: #1491750

 docs/reference/libtracker-sparql/examples/writeonly-example.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
---
diff --git a/docs/reference/libtracker-sparql/examples/writeonly-example.c 
b/docs/reference/libtracker-sparql/examples/writeonly-example.c
index ed7fc0084..94104c3d7 100644
--- a/docs/reference/libtracker-sparql/examples/writeonly-example.c
+++ b/docs/reference/libtracker-sparql/examples/writeonly-example.c
@@ -17,9 +17,9 @@ int main (int argc, const char **argv)
     "}";
 
   connection = tracker_sparql_connection_bus_new ("org.freedesktop.Tracker3.Miner.Files", NULL, NULL, 
&error);
-  if (!connection) {
+  if (!error) {
     g_printerr ("Couldn't obtain a connection to the Tracker store: %s",
-                error ? error->message : "unknown error");
+                error->message);
     g_clear_error (&error);
 
     return 1;
@@ -33,7 +33,7 @@ int main (int argc, const char **argv)
   if (error) {
     /* Some error happened performing the query, not good */
     g_printerr ("Couldn't update the Tracker store: %s",
-                error ? error->message : "unknown error");
+                error->message);
 
     g_clear_error (&error);
     g_object_unref (connection);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]