diff options
-rw-r--r-- | gnu/usr.bin/ld/ldd/ldd.c | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/gnu/usr.bin/ld/ldd/ldd.c b/gnu/usr.bin/ld/ldd/ldd.c index 011d8259c4a..c61de2a388f 100644 --- a/gnu/usr.bin/ld/ldd/ldd.c +++ b/gnu/usr.bin/ld/ldd/ldd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ldd.c,v 1.4 1998/03/26 19:46:55 niklas Exp $ */ +/* $OpenBSD: ldd.c,v 1.5 1999/05/21 01:20:45 espie Exp $ */ /* $NetBSD: ldd.c,v 1.12 1995/10/09 00:14:41 pk Exp $ */ /* * Copyright (c) 1993 Paul Kranenburg @@ -105,8 +105,20 @@ char *argv[]; argv++; continue; } - if (read(fd, &hdr, sizeof hdr) != sizeof hdr - || (N_GETFLAG(hdr) & EX_DPMASK) != EX_DYNAMIC + if (read(fd, &hdr, sizeof hdr) != sizeof hdr) { + warnx("%s: not a dynamic executable", *argv); + (void)close(fd); + rval |= 1; + argv++; + continue; + } + if ((N_GETFLAG(hdr) & EX_DPMASK) == (EX_DYNAMIC | EX_PIC)) { + warnx("%s: no support for dynamic libraries", *argv); + (void)close(fd); + argv++; + continue; + } + if ((N_GETFLAG(hdr) & EX_DPMASK) != EX_DYNAMIC #if 1 /* Compatibility */ || hdr.a_entry < N_PAGSIZ(hdr) #endif |