Changeset 29760bc


Ignore:
Timestamp:
01/07/19 18:15:40 (21 months ago)
Author:
Shane Alcock <salcock@…>
Branches:
develop
Children:
6514097
Parents:
b359a11
git-author:
Shane Alcock <salcock@…> (01/07/19 18:13:42)
git-committer:
Shane Alcock <salcock@…> (01/07/19 18:15:40)
Message:

Clear error in trace_set_hasher() before resolving the problem

If the format-specific configuration function fails when setting
the hasher, we fallback to trying to use a standard built-in
hasher. If this is successful, we need to make sure that the
trace error state is cleared otherwise the caller could call
trace_is_err() on the trace and think there was an error when
really we have already resolved the issue.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • lib/trace_parallel.c

    r9c46b65 r29760bc  
    22772277
    22782278        if (ret == -1) {
     2279                libtrace_err_t err;
     2280
    22792281                /* We have to deal with this ourself */
     2282                /* If we succeed, clear any error state otherwise our caller
     2283                 * might assume an error occurred, even though we've resolved
     2284                 * the issue ourselves.
     2285                 */
    22802286                if (!hasher) {
    22812287                        switch (type)
     
    22832289                                case HASHER_CUSTOM:
    22842290                                case HASHER_BALANCE:
     2291                                        err = trace_get_err(trace);
    22852292                                        return 0;
    22862293                                case HASHER_BIDIRECTIONAL:
     
    22882295                                        trace->hasher_data = calloc(1, sizeof(toeplitz_conf_t));
    22892296                                        toeplitz_init_config(trace->hasher_data, 1);
     2297                                        err = trace_get_err(trace);
    22902298                                        return 0;
    22912299                                case HASHER_UNIDIRECTIONAL:
     
    22932301                                        trace->hasher_data = calloc(1, sizeof(toeplitz_conf_t));
    22942302                                        toeplitz_init_config(trace->hasher_data, 0);
     2303                                        err = trace_get_err(trace);
    22952304                                        return 0;
    22962305                        }
Note: See TracChangeset for help on using the changeset viewer.