check unlink() return value in test
authorChristian Grothoff <christian@grothoff.org>
Mon, 13 Mar 2017 17:07:59 +0000 (18:07 +0100)
committerChristian Grothoff <christian@grothoff.org>
Mon, 13 Mar 2017 17:07:59 +0000 (18:07 +0100)
src/sq/test_sq.c

index e6896861ea7cd6e135c867c24eeaf8f6fd1ad310..42c321666d3e0afc3f49e7c98a30a536c17fb751 100644 (file)
@@ -254,7 +254,10 @@ main(int argc,
     fprintf (stderr,
             "Failed to create table\n");
     sqlite3_close (dbh);
-    unlink ("test.db");
+    if (0 != unlink ("test.db"))
+      GNUNET_log_strerror_file (GNUNET_ERROR_TYPE_ERROR,
+                                "unlink",
+                                "test.db");
     return 1;
   }
 
@@ -266,12 +269,13 @@ main(int argc,
   {
     fprintf (stderr,
             "Failed to drop table\n");
-    sqlite3_close (dbh);
-    unlink ("test.db");
-    return 1;
+    ret = 1;
   }
   sqlite3_close (dbh);
-  unlink ("test.db");
+  if (0 != unlink ("test.db"))
+    GNUNET_log_strerror_file (GNUNET_ERROR_TYPE_ERROR,
+                              "unlink",
+                              "test.db");
   return ret;
 }