From: Christian Grothoff Date: Wed, 5 May 2010 13:39:20 +0000 (+0000) Subject: bugs X-Git-Tag: initial-import-from-subversion-38251~21878 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=eb123f37892e3fd79a33f0375ab99a52dc4b6915;p=oweals%2Fgnunet.git bugs --- diff --git a/src/fs/fs.c b/src/fs/fs.c index 817b29d7f..00948916e 100644 --- a/src/fs/fs.c +++ b/src/fs/fs.c @@ -424,7 +424,7 @@ get_serialization_file_name (struct GNUNET_FS_Handle *h, &basename)) return NULL; GNUNET_asprintf (&ret, - "%s%s%s%s%s%s", + "%s%s%s%s%s%s%s", basename, DIR_SEPARATOR_STR, h->client_name, @@ -466,7 +466,7 @@ get_serialization_file_name_in_dir (struct GNUNET_FS_Handle *h, &basename)) return NULL; GNUNET_asprintf (&ret, - "%s%s%s%s%s%s%s%s", + "%s%s%s%s%s%s%s%s%s", basename, DIR_SEPARATOR_STR, h->client_name, @@ -524,8 +524,14 @@ get_write_handle (struct GNUNET_FS_Handle *h, fn = get_serialization_file_name (h, ext, ent); if (fn == NULL) - return NULL; + { + return NULL; + } ret = GNUNET_BIO_write_open (fn); + if (ret == NULL) + fprintf (stderr, + "Failed to create write handle for `%s' from `%s/%s'\n", + fn, ext, ent); GNUNET_free (fn); return ret; } @@ -950,7 +956,7 @@ get_serialization_short_name (const char *fullname) nxt = fullname; /* FIXME: we could do this faster since we know the length of 'end'... */ - while ('\0' != nxt) + while ('\0' != *nxt) { if (DIR_SEPARATOR == *nxt) end = nxt + 1; @@ -1190,7 +1196,7 @@ GNUNET_FS_file_information_sync_ (struct GNUNET_FS_FileInformation * fi) goto cleanup; } if (GNUNET_OK != - GNUNET_BIO_write_string (wh, fi->next->serialization)) + GNUNET_BIO_write_string (wh, (fi->next != NULL) ? fi->next->serialization : NULL)) goto cleanup; if (GNUNET_OK == GNUNET_BIO_write_close (wh)) @@ -1429,6 +1435,8 @@ GNUNET_FS_publish_sync_ (struct GNUNET_FS_PublishContext *pc) return; } wh = get_write_handle (pc->h, GNUNET_FS_SYNC_PATH_MASTER_PUBLISH, pc->serialization); + if (wh == NULL) + goto cleanup; if ( (GNUNET_OK != GNUNET_BIO_write_string (wh, pc->nid)) || (GNUNET_OK != @@ -1483,6 +1491,8 @@ GNUNET_FS_unindex_sync_ (struct GNUNET_FS_UnindexContext *uc) if (NULL == uc->serialization) return; wh = get_write_handle (uc->h, GNUNET_FS_SYNC_PATH_MASTER_UNINDEX, uc->serialization); + if (wh == NULL) + goto cleanup; if ( (GNUNET_OK != GNUNET_BIO_write_string (wh, uc->filename)) || (GNUNET_OK != @@ -1736,6 +1746,8 @@ GNUNET_FS_search_result_sync_ (struct GNUNET_FS_SearchResult *sr) : GNUNET_FS_SYNC_PATH_CHILD_SEARCH, sr->sc->serialization, sr->serialization); + if (wh == NULL) + goto cleanup; uris = GNUNET_FS_uri_to_string (sr->uri); if ( (GNUNET_OK != GNUNET_BIO_write_string (wh, uris)) || @@ -1804,6 +1816,8 @@ GNUNET_FS_search_sync_ (struct GNUNET_FS_SearchContext *sc) if (NULL == sc->serialization) return; wh = get_write_handle (sc->h, category, sc->serialization); + if (wh == NULL) + goto cleanup; GNUNET_assert ( (GNUNET_YES == GNUNET_FS_uri_test_ksk (sc->uri)) || (GNUNET_YES == GNUNET_FS_uri_test_sks (sc->uri)) ); uris = GNUNET_FS_uri_to_string (sc->uri); diff --git a/src/fs/fs_publish.c b/src/fs/fs_publish.c index ba2d09533..6364dac0a 100644 --- a/src/fs/fs_publish.c +++ b/src/fs/fs_publish.c @@ -557,6 +557,7 @@ publish_content (struct GNUNET_FS_PublishContext *sc) uint64_t size; p = sc->fi_pos; + GNUNET_assert (p != NULL); if (NULL == p->te) { if (p->is_directory) @@ -1062,13 +1063,13 @@ GNUNET_FS_publish_start (struct GNUNET_FS_Handle *h, if (NULL != nuid) ret->nuid = GNUNET_strdup (nuid); } - GNUNET_FS_publish_sync_ (ret); /* signal start */ GNUNET_FS_file_information_inspect (ret->fi, &fip_signal_start, ret); ret->fi_pos = ret->fi; ret->top = GNUNET_FS_make_top (h, &publish_signal_suspend, ret); + GNUNET_FS_publish_sync_ (ret); // FIXME: calculate space needed for "fi" // and reserve as first task (then trigger // "publish_main" from that continuation)! diff --git a/src/fs/fs_unindex.c b/src/fs/fs_unindex.c index c5502d3fe..d422546ca 100644 --- a/src/fs/fs_unindex.c +++ b/src/fs/fs_unindex.c @@ -454,6 +454,7 @@ GNUNET_FS_unindex_start (struct GNUNET_FS_Handle *h, pi.status = GNUNET_FS_STATUS_UNINDEX_START; pi.value.unindex.eta = GNUNET_TIME_UNIT_FOREVER_REL; GNUNET_FS_unindex_make_status_ (&pi, ret, 0); + /* FIXME: must be able to abort hashing here! */ GNUNET_CRYPTO_hash_file (h->sched, GNUNET_SCHEDULER_PRIORITY_IDLE, filename, @@ -476,7 +477,12 @@ void GNUNET_FS_unindex_stop (struct GNUNET_FS_UnindexContext *uc) { struct GNUNET_FS_ProgressInfo pi; - + + /* FIXME: stop hashing (if still ongoing) */ + /* FIXME: disconnect uc->client (if still connected) */ + /* FIXME: disconnect from datastore (if still connected) */ + /* FIXME: other termination operations? */ + /* FIXME: must do same cleanup in 'unindex_signal_suspend'! */ GNUNET_FS_end_top (uc->h, uc->top); if ( (uc->state != UNINDEX_STATE_COMPLETE) && (uc->state != UNINDEX_STATE_ERROR) )