Skip to content

Commit

Permalink
Stop searching in further dirs on errors except ENOENT #12
Browse files Browse the repository at this point in the history
if a terminfo file was found during the directory search, loaded, and then found to contain an error, the search continues into other locations. If this eventually fails, the error is always ENOENT, thus swallowing the reason that the file which was found, had errored.

This PR changes the behaviour, stopping on the first error that is not ENOENT.

ref: mauke#41
  • Loading branch information
blueyed authored and justinmk committed Aug 11, 2019
1 parent 1d93ed4 commit 5b9aee2
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions uniutil.c
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ static unibi_term *from_dirs(const char *list, const char *term) {
z = strchr(a, ':');

ut = from_dir(a, z, NULL, term);
if (ut) {
if (ut || errno != ENOENT) {
return ut;
}

Expand Down Expand Up @@ -196,7 +196,7 @@ unibi_term *unibi_from_term(const char *term) {

if ((env = getenv("HOME"))) {
ut = from_dir(env, NULL, ".terminfo", term);
if (ut) {
if (ut || errno != ENOENT) {
return ut;
}
}
Expand Down

0 comments on commit 5b9aee2

Please sign in to comment.