From 46b723ebd22301be02cfbca34c471f9397f163c5 Mon Sep 17 00:00:00 2001 From: Carlo von lynX Date: Wed, 27 Jul 2016 23:15:28 +0000 Subject: social: fix various warnings --- src/include/gnunet_social_service.h | 12 +++++++---- src/social/gnunet-service-social.c | 43 +++++++++++++++++++++---------------- src/social/gnunet-social.c | 8 +++---- src/social/social_api.c | 14 ++++++++---- src/social/test_social.c | 2 +- 5 files changed, 48 insertions(+), 31 deletions(-) (limited to 'src') diff --git a/src/include/gnunet_social_service.h b/src/include/gnunet_social_service.h index b0f5dbd16..e9c7f309c 100644 --- a/src/include/gnunet_social_service.h +++ b/src/include/gnunet_social_service.h @@ -194,7 +194,7 @@ Description of file Messages with a _file method contain a file, which is saved to disk upon reception at the following location: -$GNUNET_DATA_HOME/social/files// +$GNUNET_DATA_HOME/social/files// ### Environment @@ -386,7 +386,7 @@ typedef void /** * Establish application connection to the social service. * - * The @host_place_cb and @guest_place_cb functions are + * The @host_cb and @guest_cb functions are * initially called for each entered places, * then later each time a new place is entered with the current app ID. * @@ -416,8 +416,12 @@ GNUNET_SOCIAL_app_connect (const struct GNUNET_CONFIGURATION_Handle *cfg, /** * Disconnect app. * - * @param c - * App handle. + * @param app + * Application handle. + * @param disconnect_cb + * Disconnect callback. + * @param disconnect_cls + * Disconnect closure. */ void GNUNET_SOCIAL_app_disconnect (struct GNUNET_SOCIAL_App *app, diff --git a/src/social/gnunet-service-social.c b/src/social/gnunet-service-social.c index 287047f58..eca1b14d7 100644 --- a/src/social/gnunet-service-social.c +++ b/src/social/gnunet-service-social.c @@ -989,19 +989,23 @@ place_recv_save_data (void *cls, struct GNUNET_DISK_FileHandle * fh = GNUNET_DISK_file_open (filename, GNUNET_DISK_OPEN_WRITE, GNUNET_DISK_PERM_NONE); - GNUNET_free (filename); - if (NULL != fh) { - GNUNET_DISK_file_seek (fh, plc->file_offset, GNUNET_DISK_SEEK_SET); + if (plc->file_offset != GNUNET_DISK_file_seek + (fh, plc->file_offset, GNUNET_DISK_SEEK_SET)) { + GNUNET_log_strerror_file (GNUNET_ERROR_TYPE_ERROR, "seek", filename); + GNUNET_free (filename); + return; + } GNUNET_DISK_file_write (fh, data, data_size); GNUNET_DISK_file_close (fh); + GNUNET_free (filename); } else { + GNUNET_free (filename); GNUNET_break (0); } - plc->file_offset += data_size; } @@ -1033,7 +1037,11 @@ place_recv_save_eom (void *cls, char *fn_part = NULL; GNUNET_asprintf (&fn_part, "%s.part", fn); - rename (fn_part, fn); + if (rename (fn_part, fn)) { + GNUNET_log (GNUNET_ERROR_TYPE_ERROR, + "Failed to rename %s into %s: %s (%d)\n", + fn_part, fn, strerror (errno), errno); + } GNUNET_free (fn); GNUNET_free (fn_part); @@ -1098,8 +1106,8 @@ place_add (const struct PlaceEnterRequest *ereq) * * @param app_id * Application ID. - * @param msg - * Entry message. + * @param ereq + * Entry request. * * @return #GNUNET_OK if the place was added * #GNUNET_NO if the place already exists in the hash map @@ -1183,8 +1191,8 @@ app_place_add (const char *app_id, * * @param app_id * Application ID. - * @param msg - * Entry message. + * @param ereq + * Entry request message. */ static int app_place_save (const char *app_id, @@ -1302,8 +1310,8 @@ app_place_remove (const char *app_id, /** * Enter place as host. * - * @param req - * Entry request. + * @param hreq + * Host entry request. * @param[out] ret_hst * Returned Host struct. * @@ -1541,8 +1549,8 @@ client_recv_host_enter (void *cls, struct GNUNET_SERVER_Client *client, /** * Enter place as guest. * - * @param req - * Entry request. + * @param greq + * Guest entry request. * @param[out] ret_gst * Returned Guest struct. * @@ -1589,6 +1597,7 @@ guest_enter (const struct GuestEnterRequest *greq, struct Guest **ret_gst) len = strnlen (app_id, remaining); if (len == remaining) { + GNUNET_free (gst); GNUNET_break (0); return GNUNET_SYSERR; } @@ -1623,8 +1632,8 @@ guest_enter (const struct GuestEnterRequest *greq, struct Guest **ret_gst) GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "%zu + %u + %u != %u\n", sizeof (*greq), relay_size, join_msg_size, greq_size); - GNUNET_break (0); GNUNET_free (gst); + GNUNET_break (0); return GNUNET_SYSERR; } if (0 < relay_size) @@ -2595,10 +2604,8 @@ guest_transmit_notify_mod (void *cls, uint16_t *data_size, void *data, /** * Get method part of next message from transmission queue. * - * @param tmit_msg - * Next item in message transmission queue. - * @param[out] pmeth - * The malloc'd message method is returned here. + * @param plc + * Place * * @return #GNUNET_OK on success * #GNUNET_NO if there are no more messages in queue. diff --git a/src/social/gnunet-social.c b/src/social/gnunet-social.c index ed3801abc..68a45bd5e 100644 --- a/src/social/gnunet-social.c +++ b/src/social/gnunet-social.c @@ -1055,9 +1055,9 @@ app_recv_ego (void *cls, const struct GNUNET_CRYPTO_EcdsaPublicKey *pub_key, const char *name) { - GNUNET_log (GNUNET_ERROR_TYPE_WARNING, - "Ego: %s\t%s\n", - GNUNET_CRYPTO_ecdsa_public_key_to_string (pub_key), name); + char *s = GNUNET_CRYPTO_ecdsa_public_key_to_string (pub_key); + GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "Ego: %s\t%s\n", s, name); + GNUNET_free (s); if (0 == memcmp (&ego_pub_key, pub_key, sizeof (*pub_key)) || (NULL != opt_ego && 0 == strcmp (opt_ego, name))) @@ -1107,7 +1107,7 @@ core_connected (void *cls, const struct GNUNET_PeerIdentity *my_identity) * @param cls closure * @param args remaining command-line arguments * @param cfgfile name of the configuration file used (for saving, can be NULL!) - * @param cfg configuration + * @param c configuration */ static void run (void *cls, char *const *args, const char *cfgfile, diff --git a/src/social/social_api.c b/src/social/social_api.c index 926995f6b..c33f39dce 100644 --- a/src/social/social_api.c +++ b/src/social/social_api.c @@ -2452,11 +2452,13 @@ GNUNET_SOCIAL_zone_add_nym (const struct GNUNET_SOCIAL_App *app, * Configuration. * @param id * Application ID. - * @param notify_host + * @param ego_cb + * Function to notify about an available ego. + * @param host_cb * Function to notify about a place entered as host. - * @param notify_guest - * Function to notify about a place entered as guest.. - * @param notify_cls + * @param guest_cb + * Function to notify about a place entered as guest. + * @param cls * Closure for the callbacks. * * @return Handle that can be used to stop listening. @@ -2507,6 +2509,10 @@ GNUNET_SOCIAL_app_connect (const struct GNUNET_CONFIGURATION_Handle *cfg, * * @param app * Application handle. + * @param disconnect_cb + * Disconnect callback. + * @param disconnect_cls + * Disconnect closure. */ void GNUNET_SOCIAL_app_disconnect (struct GNUNET_SOCIAL_App *app, diff --git a/src/social/test_social.c b/src/social/test_social.c index dc73705c6..eb32a031f 100644 --- a/src/social/test_social.c +++ b/src/social/test_social.c @@ -1082,7 +1082,7 @@ host_answer_door (void *cls, GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "Test #%u: Host received entry request from guest (try %u).\n", - test, join_req_count); + (uint8_t) test, join_req_count); GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "%s\n%.*s\n", method_name, data_size, (const char *) data); -- cgit v1.2.3