Deleted Added
full compact
btxld.c (154711) btxld.c (177933)
1/*
2 * Copyright (c) 1998 Robert Nordier
3 * 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

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

21 * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
22 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
23 * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
24 * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25 */
26
27#ifndef lint
28static const char rcsid[] =
1/*
2 * Copyright (c) 1998 Robert Nordier
3 * 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

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

21 * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
22 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
23 * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
24 * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25 */
26
27#ifndef lint
28static const char rcsid[] =
29 "$FreeBSD: head/usr.sbin/btxld/btxld.c 154711 2006-01-23 13:55:32Z delphij $";
29 "$FreeBSD: head/usr.sbin/btxld/btxld.c 177933 2008-04-05 10:26:20Z dfr $";
30#endif /* not lint */
31
32#include <sys/param.h>
33#include <sys/endian.h>
34#include <sys/stat.h>
35#include <sys/mman.h>
36
37/* XXX make this work as an i386/amd64 cross-tool */

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

331 unsigned int fmt, x, n, i;
332
333 memset(hdr, 0, sizeof(*hdr));
334 if (fstat(fd, &sb))
335 err(2, "%s", fname);
336 if (sb.st_size > MAXU32)
337 errx(1, "%s: Too big", fname);
338 hdr->size = sb.st_size;
30#endif /* not lint */
31
32#include <sys/param.h>
33#include <sys/endian.h>
34#include <sys/stat.h>
35#include <sys/mman.h>
36
37/* XXX make this work as an i386/amd64 cross-tool */

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

331 unsigned int fmt, x, n, i;
332
333 memset(hdr, 0, sizeof(*hdr));
334 if (fstat(fd, &sb))
335 err(2, "%s", fname);
336 if (sb.st_size > MAXU32)
337 errx(1, "%s: Too big", fname);
338 hdr->size = sb.st_size;
339 if (!hdr->size)
340 return;
339 if ((p = mmap(NULL, hdr->size, PROT_READ, MAP_SHARED, fd,
340 0)) == MAP_FAILED)
341 err(2, "%s", fname);
342 for (fmt = F_CNT - 1; !hdr->fmt && fmt; fmt--)
343 switch (fmt) {
344 case F_AOUT:
345 ex = p;
346 if (hdr->size >= sizeof(struct exec) && !N_BADMAG(*ex)) {

--- 227 unchanged lines hidden ---
341 if ((p = mmap(NULL, hdr->size, PROT_READ, MAP_SHARED, fd,
342 0)) == MAP_FAILED)
343 err(2, "%s", fname);
344 for (fmt = F_CNT - 1; !hdr->fmt && fmt; fmt--)
345 switch (fmt) {
346 case F_AOUT:
347 ex = p;
348 if (hdr->size >= sizeof(struct exec) && !N_BADMAG(*ex)) {

--- 227 unchanged lines hidden ---