diff options
author | jdp <jdp@FreeBSD.org> | 1998-09-05 20:28:48 +0000 |
---|---|---|
committer | jdp <jdp@FreeBSD.org> | 1998-09-05 20:28:48 +0000 |
commit | 2b7c06f6c81fb0ed6851913e99c56eeaa3f00ef0 (patch) | |
tree | 52948956250a88b5c6549461a46f38781902d45e | |
parent | 0f44756d5a672d17ddbf8721ef8f2cfac33b6d2b (diff) | |
download | FreeBSD-src-2b7c06f6c81fb0ed6851913e99c56eeaa3f00ef0.zip FreeBSD-src-2b7c06f6c81fb0ed6851913e99c56eeaa3f00ef0.tar.gz |
Don't recognize a file as an a.out shared library unless it has at
least 2 version numbers. This fixes the bug where the dynamic
linker would try to load an ELF shared library if it found one.
Note, this change also fixes the same thing in "ld", because the
code is shared.
For "ld" there is still a problem with ".a" libraries, which cannot
be distinguished by name. I haven't decided what, if anything, to
do about that.
-rw-r--r-- | libexec/rtld-aout/shlib.c | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/libexec/rtld-aout/shlib.c b/libexec/rtld-aout/shlib.c index 34d88e9..5bd968f 100644 --- a/libexec/rtld-aout/shlib.c +++ b/libexec/rtld-aout/shlib.c @@ -27,7 +27,7 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * $Id: shlib.c,v 1.19 1998/05/26 20:12:49 sos Exp $ + * $Id: shlib.c,v 1.20 1998/06/07 03:53:08 brian Exp $ */ #include <sys/param.h> @@ -301,15 +301,14 @@ search_lib_dir(dir, name, majorp, minorp, do_dot_a) int cur_ndewey; cur_ndewey = getdewey(cur_dewey, extension+3); - if(cur_ndewey == 0) /* No version number */ + if(cur_ndewey < 2) /* Too few version numbers */ continue; if(*majorp != -1) { /* Need exact match on major */ if(cur_dewey[0] != *majorp) continue; if(*minorp != -1) { /* Need minor >= minimum */ - if(cur_ndewey < 2 || - cur_dewey[1] < *minorp) + if(cur_dewey[1] < *minorp) continue; } } @@ -330,8 +329,7 @@ search_lib_dir(dir, name, majorp, minorp, do_dot_a) if(dot_so_name[0] != '\0') { *majorp = best_dewey[0]; - if(best_ndewey >= 2) - *minorp = best_dewey[1]; + *minorp = best_dewey[1]; return concat(dir, "/", dot_so_name); } |