+
+/**
+ * Function called to iterate over a directory.
+ *
+ * @param cls closure
+ * @param di argument to pass to "GNUNET_DISK_directory_iterator_next" to
+ * get called on the next entry (or finish cleanly);
+ * NULL on error (will be the last call in that case)
+ * @param filename complete filename (absolute path)
+ * @param dirname directory name (absolute path)
+ */
+static void
+iterator_cb (void *cls, struct GNUNET_DISK_DirectoryIterator *di,
+ const char *filename, const char *dirname)
+{
+ const char *fn;
+ size_t len;
+ uint64_t fs;
+ int cancel;
+
+ cancel = GNUNET_NO;
+ if (NULL == filename)
+ goto iteration_cont;
+ len = strlen (filename);
+ if (len < 5) /* log file: `pid'.dat */
+ goto iteration_cont;
+ fn = filename + len;
+ if (0 != strcasecmp (".dat", fn - 4))
+ goto iteration_cont;
+ if (GNUNET_OK != GNUNET_DISK_file_size (filename, &fs,
+ GNUNET_NO, GNUNET_YES))
+ goto iteration_cont;
+ if ((BSIZE * 2) != fs) /* The file size should be equal to what we
+ have written */
+ goto iteration_cont;
+
+ cancel = GNUNET_YES;
+ result = GNUNET_OK;
+
+ iteration_cont:
+ if ( (NULL != di) &&
+ (GNUNET_YES != GNUNET_DISK_directory_iterator_next (di, cancel)) )
+ return;
+ shutdown_now ();
+}
+