Changeset dc62550 for lib/trace.c


Ignore:
Timestamp:
11/10/18 22:30:26 (2 years ago)
Author:
Jacob van Walraven <jacobvw@…>
Branches:
develop
Children:
ccb2507
Parents:
acffeb8
Message:

Print a more suitable error when the input URI (file) is not found

File:
1 edited

Legend:

Unmodified
Added
Removed
  • lib/trace.c

    r47d4f8c rdc62550  
    305305                guess_format(libtrace,uri);
    306306                if (!libtrace->format) {
    307                         trace_set_err(libtrace,TRACE_ERR_BAD_FORMAT,"Unable to guess format (%s)",uri);
     307                        /* Check if the file exists */
     308                        FILE *file;
     309                        if(!(file=fopen(uri, "r"))) {
     310                                trace_set_err(libtrace,TRACE_ERR_URI_NOT_FOUND,"Unable to find URI (%s)",uri);
     311                        } else {
     312                                fclose(file);
     313                                trace_set_err(libtrace,TRACE_ERR_BAD_FORMAT,"Unable to guess format (%s)",uri);
     314                        }
    308315                        return libtrace;
    309316                }
Note: See TracChangeset for help on using the changeset viewer.