gnunet-svn
[Top][All Lists]
Advanced

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

[gnunet] branch master updated: -fix return value of GNUNET_disk_glob


From: gnunet
Subject: [gnunet] branch master updated: -fix return value of GNUNET_disk_glob
Date: Thu, 29 Jul 2021 20:25:09 +0200

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

dold pushed a commit to branch master
in repository gnunet.

The following commit(s) were added to refs/heads/master by this push:
     new 1cf24fd82 -fix return value of GNUNET_disk_glob
1cf24fd82 is described below

commit 1cf24fd82adebf83ac0b01fc3a4b7de2322e075a
Author: Florian Dold <florian@dold.me>
AuthorDate: Thu Jul 29 20:21:48 2021 +0200

    -fix return value of GNUNET_disk_glob
---
 src/util/disk.c | 17 ++++++++++++++---
 1 file changed, 14 insertions(+), 3 deletions(-)

diff --git a/src/util/disk.c b/src/util/disk.c
index bc7be8960..ada35249f 100644
--- a/src/util/disk.c
+++ b/src/util/disk.c
@@ -956,6 +956,11 @@ struct GlobClosure
   const char *glob;
   GNUNET_FileNameCallback cb;
   void *cls;
+
+  /**
+   * Number of files that actually matched the glob pattern.
+   */
+  int nres;
 };
 
 /**
@@ -984,10 +989,15 @@ glob_cb (void *cls,
 
   if (glob_match (gc->glob, fn))
   {
+    enum GNUNET_GenericReturnValue cbret;
+
     LOG (GNUNET_ERROR_TYPE_DEBUG,
          "found glob match '%s'\n",
          filename);
-    gc->cb (gc->cls, filename);
+    gc->nres++;
+    cbret = gc->cb (gc->cls, filename);
+    if (GNUNET_OK != cbret)
+      return cbret;
   }
   return GNUNET_OK;
 }
@@ -1036,6 +1046,7 @@ GNUNET_DISK_glob (const char *glob_pattern,
       .glob = sep + 1,
       .cb = callback,
       .cls = callback_cls,
+      .nres = 0,
     };
     LOG (GNUNET_ERROR_TYPE_DEBUG,
          "scanning directory '%s' for glob matches on '%s'\n",
@@ -1045,9 +1056,9 @@ GNUNET_DISK_glob (const char *glob_pattern,
                                       glob_cb,
                                       &gc
                                       );
+    GNUNET_free (mypat);
+    return (ret < 0) ? ret : gc.nres;
   }
-  GNUNET_free (mypat);
-  return ret;
 }
 
 

-- 
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]