Skip to content

Commit 5b9aee2

Browse files
blueyedjustinmk
authored andcommitted
Stop searching in further dirs on errors except ENOENT #12
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
1 parent 1d93ed4 commit 5b9aee2

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

uniutil.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ static unibi_term *from_dirs(const char *list, const char *term) {
162162
z = strchr(a, ':');
163163

164164
ut = from_dir(a, z, NULL, term);
165-
if (ut) {
165+
if (ut || errno != ENOENT) {
166166
return ut;
167167
}
168168

@@ -196,7 +196,7 @@ unibi_term *unibi_from_term(const char *term) {
196196

197197
if ((env = getenv("HOME"))) {
198198
ut = from_dir(env, NULL, ".terminfo", term);
199-
if (ut) {
199+
if (ut || errno != ENOENT) {
200200
return ut;
201201
}
202202
}

0 commit comments

Comments
 (0)