Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/usr.bin/ldd/ldd_elf Get stat info and pass it to the object ...



details:   https://anonhg.NetBSD.org/src/rev/b883a313a37a
branches:  trunk
changeset: 542771:b883a313a37a
user:      fvdl <fvdl%NetBSD.org@localhost>
date:      Thu Feb 06 12:40:21 2003 +0000

description:
Get stat info and pass it to the object map function.

diffstat:

 usr.bin/ldd/ldd_elf/ldd.c |  11 +++++++++--
 1 files changed, 9 insertions(+), 2 deletions(-)

diffs (32 lines):

diff -r 124c9773391e -r b883a313a37a usr.bin/ldd/ldd_elf/ldd.c
--- a/usr.bin/ldd/ldd_elf/ldd.c Thu Feb 06 12:38:17 2003 +0000
+++ b/usr.bin/ldd/ldd_elf/ldd.c Thu Feb 06 12:40:21 2003 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ldd.c,v 1.16 2002/12/02 14:05:11 junyoung Exp $        */
+/*     $NetBSD: ldd.c,v 1.17 2003/02/06 12:40:21 fvdl Exp $    */
 
 /*-
  * Copyright (c) 1998, 2000 The NetBSD Foundation, Inc.
@@ -106,6 +106,8 @@
 int
 main(int argc, char **argv)
 {
+       struct stat st;
+
 #ifdef DEBUG
        debug = 1;
 #endif
@@ -126,7 +128,12 @@
                        warn("%s", *argv);
                        continue;
                }
-               _rtld_objmain = _rtld_map_object(xstrdup(*argv), fd, NULL);
+               if (fstat(fd, &st) < 0) {
+                       warn("%s", *argv);
+                       close(fd);
+                       continue;
+               }
+               _rtld_objmain = _rtld_map_object(xstrdup(*argv), fd, &st);
                if (_rtld_objmain == NULL) {
                        if (ldd_aout(*argv, fd) < 0)
                                warnx("%s", error_message);



Home | Main Index | Thread Index | Old Index