diff options
author | knu <knu@FreeBSD.org> | 2002-05-17 17:06:56 +0000 |
---|---|---|
committer | knu <knu@FreeBSD.org> | 2002-05-17 17:06:56 +0000 |
commit | 66c935d52f2cea6e30797288886735b8e1c09729 (patch) | |
tree | c7bb1f6ca51ca200575a6e247b8fba4ad0351df0 /usr.bin/ldd/ldd.c | |
parent | feae66ee9578f60461aba0d558c4349607023833 (diff) | |
download | FreeBSD-src-66c935d52f2cea6e30797288886735b8e1c09729.zip FreeBSD-src-66c935d52f2cea6e30797288886735b8e1c09729.tar.gz |
Fix a tiny bug in shlib support of ldd(1); if dlopen(lib, RTLD_TRACE)
returns, exit gracefully with 0.
This fixes the behavior you see when you specify libc.so. It occurs
because ldd(1) itself is linked with libc.so.
$ ldd /usr/lib/libc.so
/usr/lib/libc.so:
ldd: /usr/lib/libc.so: (null)
/usr/lib/libc.so: exit status 1
Reviewed by: silence of audit@
Diffstat (limited to 'usr.bin/ldd/ldd.c')
-rw-r--r-- | usr.bin/ldd/ldd.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/usr.bin/ldd/ldd.c b/usr.bin/ldd/ldd.c index 8e5e5d2..68f9988 100644 --- a/usr.bin/ldd/ldd.c +++ b/usr.bin/ldd/ldd.c @@ -220,12 +220,13 @@ main(int argc, char *argv[]) } break; case 0: - if (is_shlib == 0) { + if (is_shlib) { + if (dlopen(*argv, RTLD_TRACE)) + _exit(0); /* libc.so */ + warnx("%s: %s", *argv, dlerror()); + } else { execl(*argv, *argv, (char *)NULL); warn("%s", *argv); - } else { - dlopen(*argv, RTLD_TRACE); - warnx("%s: %s", *argv, dlerror()); } _exit(1); } |