[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: CVS: cvs.openbsd.org: src [shlib.c change]
Problem is that might_take_it is seriously confused about what it's
trying to record. It's used
- to check whether a library fits,
- to check whether one library was found.
Fortunately, the first goal can be reached by simple uses of continue, without
any extra variables... I've also decided to rename it to found_match to avoid
further confusion.
Please try this. This should give us the semantics we are looking for.
--- shlib.c.orig Fri Jan 14 10:04:34 2000
+++ shlib.c Fri Jan 14 10:22:48 2000
@@ -246,12 +246,11 @@ int do_dot_a;
DIR *dd = opendir(search_dirs[i]);
struct dirent *dp;
int found_dot_a = 0;
- int might_take_it;
+ int found_match = 0;
if (dd == NULL)
continue;
- might_take_it = 0;
while ((dp = readdir(dd)) != NULL) {
int n;
@@ -281,19 +280,13 @@ int do_dot_a;
found_dot_a = 0;
}
- if (major == -1 && minor == -1) {
- might_take_it = 1;
- } else if (major != -1 && minor == -1) {
- if (tmp[0] == major)
- might_take_it = 1;
- } else if (major != -1 && minor != -1) {
- if (tmp[0] == major)
- if (n == 1 || tmp[1] >= minor)
- might_take_it = 1;
- }
-
- if (!might_take_it)
- continue;
+ /* skip inappropriate versions. */
+ if (major != -1) {
+ if (tmp[0] != major)
+ continue;
+ if (n != 1 && minor != -1 && tmp[1] < minor)
+ continue;
+ }
if (cmpndewey(tmp, n, dewey, ndewey) <= 0)
continue;
@@ -303,6 +296,7 @@ int do_dot_a;
free(path);
path = concat(search_dirs[i], "/", dp->d_name, 0);
found_dot_a = 0;
+ found_match = 1;
bcopy(tmp, dewey, sizeof(dewey));
ndewey = n;
*majorp = dewey[0];
@@ -310,7 +304,7 @@ int do_dot_a;
}
closedir(dd);
- if (found_dot_a || might_take_it)
+ if (found_dot_a || found_match)
/*
* There's a lib in this dir; take it.
*/
--
Marc Espie
|anime, sf, juggling, unicycle, acrobatics, comics...
|AmigaOS, OpenBSD, C++, perl, Icon, PostScript...
| `real programmers don't die, they just get out of beta'