From 6f1e5e46c284bf5f172404e49b0861912a09493a Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Thu, 4 Jan 2018 22:21:58 +0100 Subject: [PATCH] add assertion --- src/fs/fs_dirmetascan.c | 29 ++++++++++++++++++--------- src/gns/gnunet-service-gns_resolver.c | 3 ++- src/util/network.c | 7 ++++--- 3 files changed, 26 insertions(+), 13 deletions(-) diff --git a/src/fs/fs_dirmetascan.c b/src/fs/fs_dirmetascan.c index 8a3e37b49..e904b9092 100644 --- a/src/fs/fs_dirmetascan.c +++ b/src/fs/fs_dirmetascan.c @@ -211,9 +211,9 @@ expand_tree (struct GNUNET_FS_ShareTreeItem *parent, chld->short_filename[slen-1] = '\0'; chld->is_directory = is_directory; if (NULL != parent) - GNUNET_CONTAINER_DLL_insert (parent->children_head, - parent->children_tail, - chld); + GNUNET_CONTAINER_DLL_insert (parent->children_head, + parent->children_tail, + chld); return chld; } @@ -259,7 +259,8 @@ process_helper_msgs (void *cls, size_t left; #if 0 - fprintf (stderr, "DMS parses %u-byte message of type %u\n", + fprintf (stderr, + "DMS parses %u-byte message of type %u\n", (unsigned int) ntohs (msg->size), (unsigned int) ntohs (msg->type)); #endif @@ -277,11 +278,18 @@ process_helper_msgs (void *cls, filename, GNUNET_NO, GNUNET_FS_DIRSCANNER_FILE_START); if (NULL == ds->toplevel) + { ds->toplevel = expand_tree (ds->pos, - filename, GNUNET_NO); + filename, + GNUNET_NO); + } else + { + GNUNET_assert (NULL != ds->pos); (void) expand_tree (ds->pos, - filename, GNUNET_NO); + filename, + GNUNET_NO); + } return GNUNET_OK; case GNUNET_MESSAGE_TYPE_FS_PUBLISH_HELPER_PROGRESS_DIRECTORY: if (filename[left-1] != '\0') @@ -303,7 +311,8 @@ process_helper_msgs (void *cls, filename, GNUNET_YES, GNUNET_FS_DIRSCANNER_FILE_START); ds->pos = expand_tree (ds->pos, - filename, GNUNET_YES); + filename, + GNUNET_YES); if (NULL == ds->toplevel) ds->toplevel = ds->pos; return GNUNET_OK; @@ -360,11 +369,13 @@ process_helper_msgs (void *cls, break; } ds->progress_callback (ds->progress_callback_cls, - filename, GNUNET_YES, + filename, + GNUNET_YES, GNUNET_FS_DIRSCANNER_EXTRACT_FINISHED); if (0 < left) { - ds->pos->meta = GNUNET_CONTAINER_meta_data_deserialize (end, left); + ds->pos->meta = GNUNET_CONTAINER_meta_data_deserialize (end, + left); if (NULL == ds->pos->meta) { GNUNET_break (0); diff --git a/src/gns/gnunet-service-gns_resolver.c b/src/gns/gnunet-service-gns_resolver.c index ba71e21fa..54d7ff94b 100644 --- a/src/gns/gnunet-service-gns_resolver.c +++ b/src/gns/gnunet-service-gns_resolver.c @@ -2362,7 +2362,8 @@ GNS_resolver_lookup (const struct GNUNET_CRYPTO_EcdsaPublicKey *zone, uint32_t record_type, const char *name, enum GNUNET_GNS_LocalOptions options, - GNS_ResultProcessor proc, void *proc_cls) + GNS_ResultProcessor proc, + void *proc_cls) { struct GNS_ResolverHandle *rh; diff --git a/src/util/network.c b/src/util/network.c index cf5ef3e00..d7059a057 100644 --- a/src/util/network.c +++ b/src/util/network.c @@ -1326,9 +1326,10 @@ GNUNET_NETWORK_fdset_handle_set (struct GNUNET_NETWORK_FDSet *fds, #else int fd; - GNUNET_DISK_internal_file_handle_ (h, - &fd, - sizeof (int)); + GNUNET_assert (GNUNET_OK == + GNUNET_DISK_internal_file_handle_ (h, + &fd, + sizeof (int))); FD_SET (fd, &fds->sds); fds->nsds = GNUNET_MAX (fd + 1, -- 2.25.1