gnunet-svn
[Top][All Lists]
Advanced

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

[taler-exchange] branch master updated: avoid warning if file does not e


From: gnunet
Subject: [taler-exchange] branch master updated: avoid warning if file does not exist
Date: Fri, 15 Jan 2021 15:32:12 +0100

This is an automated email from the git hooks/post-receive script.

grothoff pushed a commit to branch master
in repository exchange.

The following commit(s) were added to refs/heads/master by this push:
     new 8c113d24 avoid warning if file does not exist
8c113d24 is described below

commit 8c113d2459b461a02927b1ce29207354cb1c275f
Author: Christian Grothoff <christian@grothoff.org>
AuthorDate: Fri Jan 15 15:32:10 2021 +0100

    avoid warning if file does not exist
---
 src/exchange-tools/taler-exchange-offline.c | 50 ++++++++++++++++-------------
 1 file changed, 27 insertions(+), 23 deletions(-)

diff --git a/src/exchange-tools/taler-exchange-offline.c 
b/src/exchange-tools/taler-exchange-offline.c
index 59e0b0a4..18c8a7b1 100644
--- a/src/exchange-tools/taler-exchange-offline.c
+++ b/src/exchange-tools/taler-exchange-offline.c
@@ -2334,34 +2334,38 @@ tofu_check (const struct TALER_SecurityModulePublicKeyP 
secm[2])
                                "SECM_TOFU_FILE");
     return GNUNET_SYSERR;
   }
-  ret = GNUNET_DISK_fn_read (fn,
-                             &old,
-                             sizeof (old));
-  if (GNUNET_SYSERR != ret)
+  if (GNUNET_OK ==
+      GNUNET_DISK_file_test (fn))
   {
-    if (ret != sizeof (old))
-    {
-      GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
-                  "File `%s' corrupt\n",
-                  fn);
-      GNUNET_free (fn);
-      return GNUNET_SYSERR;
-    }
-    /* TOFU check */
-    if (0 != memcmp (old,
-                     secm,
-                     sizeof (old)))
+    ret = GNUNET_DISK_fn_read (fn,
+                               &old,
+                               sizeof (old));
+    if (GNUNET_SYSERR != ret)
     {
-      GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
-                  "Fatal: security module keys changed (file `%s')!\n",
-                  fn);
+      if (ret != sizeof (old))
+      {
+        GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+                    "File `%s' corrupt\n",
+                    fn);
+        GNUNET_free (fn);
+        return GNUNET_SYSERR;
+      }
+      /* TOFU check */
+      if (0 != memcmp (old,
+                       secm,
+                       sizeof (old)))
+      {
+        GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+                    "Fatal: security module keys changed (file `%s')!\n",
+                    fn);
+        GNUNET_free (fn);
+        return GNUNET_SYSERR;
+      }
       GNUNET_free (fn);
-      return GNUNET_SYSERR;
+      return GNUNET_OK;
     }
-    GNUNET_free (fn);
-    return GNUNET_OK;
   }
-  else
+
   {
     char *key;
 

-- 
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]