diff --git a/coreapi/linphonecore.c b/coreapi/linphonecore.c index 7854cabe1..7b8ad5a25 100644 --- a/coreapi/linphonecore.c +++ b/coreapi/linphonecore.c @@ -390,13 +390,21 @@ static int log_collection_upload_on_send_body(belle_sip_user_body_handler_t *bh, #else FILE *log_file = fopen(log_filename, "r"); #endif - fseek(log_file, offset, SEEK_SET); - *size = fread(buffer, 1, *size, log_file); + if (fseek(log_file, offset, SEEK_SET)) { + ms_error("Cannot seek file [%s] at position [%lu] errno [%s]",log_filename,(unsigned long)offset,strerror(errno)); + + } else { + *size = fread(buffer, 1, *size, log_file); + } fclose(log_file); ms_free(log_filename); + return BELLE_SIP_CONTINUE; + } else { + *size=0; + return BELLE_SIP_STOP; } - return BELLE_SIP_CONTINUE; + } /** @@ -7391,3 +7399,12 @@ void linphone_core_multicast_lock_release(LinphoneCore *lc) { ms_warning("No wifi lock configured or not usable for core [%p]",lc); } #endif + + +LINPHONE_PUBLIC const char *linphone_core_log_collection_upload_state_to_string(const LinphoneCoreLogCollectionUploadState lcus) { + switch (lcus) { + case LinphoneCoreLogCollectionUploadStateInProgress : return "LinphoneCoreLogCollectionUploadStateInProgress"; + case LinphoneCoreLogCollectionUploadStateDelivered : return "LinphoneCoreLogCollectionUploadStateDelivered"; + case LinphoneCoreLogCollectionUploadStateNotDelivered : return "LinphoneCoreLogCollectionUploadStateNotDelivered"; + } +} diff --git a/coreapi/linphonecore.h b/coreapi/linphonecore.h index 22788939a..53f8cbcfb 100644 --- a/coreapi/linphonecore.h +++ b/coreapi/linphonecore.h @@ -1636,6 +1636,8 @@ typedef enum _LinphoneCoreLogCollectionUploadState { LinphoneCoreLogCollectionUploadStateNotDelivered, /**< Log collection upload was not delivered */ } LinphoneCoreLogCollectionUploadState; +LINPHONE_PUBLIC const char *linphone_core_log_collection_upload_state_to_string(const LinphoneCoreLogCollectionUploadState lcus); + /** * Global state notification callback. * @param lc diff --git a/tester/log_collection_tester.c b/tester/log_collection_tester.c index 32605c863..52a5d5133 100644 --- a/tester/log_collection_tester.c +++ b/tester/log_collection_tester.c @@ -273,6 +273,9 @@ static void collect_files_changing_size() { static void logCollectionUploadStateChangedCb(LinphoneCore *lc, LinphoneCoreLogCollectionUploadState state, const char *info) { stats* counters = get_stats(lc); + ms_message("lc [%p], logCollectionUploadStateChanged to [%s], info [%s]",lc + ,linphone_core_log_collection_upload_state_to_string(state) + ,info); switch(state) { case LinphoneCoreLogCollectionUploadStateInProgress: counters->number_of_LinphoneCoreLogCollectionUploadStateInProgress++;