Deleted Added
full compact
nlist.c (55837) nlist.c (56698)
1/*
2 * Copyright (c) 1989, 1993
3 * The Regents of the University of California. All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 16 unchanged lines hidden (view full) ---

25 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
26 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
27 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
28 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
30 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31 * SUCH DAMAGE.
32 *
1/*
2 * Copyright (c) 1989, 1993
3 * The Regents of the University of California. All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 16 unchanged lines hidden (view full) ---

25 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
26 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
27 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
28 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
30 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31 * SUCH DAMAGE.
32 *
33 * $FreeBSD: head/lib/libc/gen/nlist.c 55837 2000-01-12 09:23:48Z jasone $
33 * $FreeBSD: head/lib/libc/gen/nlist.c 56698 2000-01-27 23:07:25Z jasone $
34 */
35
36#if defined(LIBC_SCCS) && !defined(lint)
37static char sccsid[] = "@(#)nlist.c 8.1 (Berkeley) 6/4/93";
38#endif /* LIBC_SCCS and not lint */
39
40#include <sys/param.h>
41#include <sys/mman.h>

--- 19 unchanged lines hidden (view full) ---

61
62int
63nlist(name, list)
64 const char *name;
65 struct nlist *list;
66{
67 int fd, n;
68
34 */
35
36#if defined(LIBC_SCCS) && !defined(lint)
37static char sccsid[] = "@(#)nlist.c 8.1 (Berkeley) 6/4/93";
38#endif /* LIBC_SCCS and not lint */
39
40#include <sys/param.h>
41#include <sys/mman.h>

--- 19 unchanged lines hidden (view full) ---

61
62int
63nlist(name, list)
64 const char *name;
65 struct nlist *list;
66{
67 int fd, n;
68
69 fd = _libc_open(name, O_RDONLY, 0);
69 fd = _open(name, O_RDONLY, 0);
70 if (fd < 0)
71 return (-1);
72 n = __fdnlist(fd, list);
70 if (fd < 0)
71 return (-1);
72 n = __fdnlist(fd, list);
73 (void)_libc_close(fd);
73 (void)_close(fd);
74 return (n);
75}
76
77static struct nlist_handlers {
78 int (*fn) __P((int fd, struct nlist *list));
79} nlist_fn[] = {
80#ifdef _NLIST_DO_AOUT
81 { __aout_fdnlist },

--- 168 unchanged lines hidden (view full) ---

250 Elf_Shdr *shdr = NULL;
251 Elf_Shdr *sh;
252 Elf_Word shdr_size;
253 void *base;
254 struct stat st;
255
256 /* Make sure obj is OK */
257 if (lseek(fd, (off_t)0, SEEK_SET) == -1 ||
74 return (n);
75}
76
77static struct nlist_handlers {
78 int (*fn) __P((int fd, struct nlist *list));
79} nlist_fn[] = {
80#ifdef _NLIST_DO_AOUT
81 { __aout_fdnlist },

--- 168 unchanged lines hidden (view full) ---

250 Elf_Shdr *shdr = NULL;
251 Elf_Shdr *sh;
252 Elf_Word shdr_size;
253 void *base;
254 struct stat st;
255
256 /* Make sure obj is OK */
257 if (lseek(fd, (off_t)0, SEEK_SET) == -1 ||
258 _libc_read(fd, &ehdr, sizeof(Elf_Ehdr)) != sizeof(Elf_Ehdr) ||
258 _read(fd, &ehdr, sizeof(Elf_Ehdr)) != sizeof(Elf_Ehdr) ||
259 !__elf_is_okay__(&ehdr) ||
260 fstat(fd, &st) < 0)
261 return (-1);
262
263 /* calculate section header table size */
264 shdr_size = ehdr.e_shentsize * ehdr.e_shnum;
265
266 /* Make sure it's not too big to mmap */

--- 67 unchanged lines hidden (view full) ---

334
335 if (lseek(fd, (off_t) symoff, SEEK_SET) == -1) {
336 nent = -1;
337 goto done;
338 }
339
340 while (symsize > 0 && nent > 0) {
341 cc = MIN(symsize, sizeof(sbuf));
259 !__elf_is_okay__(&ehdr) ||
260 fstat(fd, &st) < 0)
261 return (-1);
262
263 /* calculate section header table size */
264 shdr_size = ehdr.e_shentsize * ehdr.e_shnum;
265
266 /* Make sure it's not too big to mmap */

--- 67 unchanged lines hidden (view full) ---

334
335 if (lseek(fd, (off_t) symoff, SEEK_SET) == -1) {
336 nent = -1;
337 goto done;
338 }
339
340 while (symsize > 0 && nent > 0) {
341 cc = MIN(symsize, sizeof(sbuf));
342 if (_libc_read(fd, sbuf, cc) != cc)
342 if (_read(fd, sbuf, cc) != cc)
343 break;
344 symsize -= cc;
345 for (s = sbuf; cc > 0 && nent > 0; ++s, cc -= sizeof(*s)) {
346 char *name;
347 struct nlist *p;
348
349 name = strtab + s->st_name;
350 if (name[0] == '\0')

--- 63 unchanged lines hidden ---
343 break;
344 symsize -= cc;
345 for (s = sbuf; cc > 0 && nent > 0; ++s, cc -= sizeof(*s)) {
346 char *name;
347 struct nlist *p;
348
349 name = strtab + s->st_name;
350 if (name[0] == '\0')

--- 63 unchanged lines hidden ---