Deleted Added
full compact
ldconfig.c (1741) ldconfig.c (5205)
1/*
2 * Copyright (c) 1993 Paul Kranenburg
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

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

22 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
23 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
24 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
28 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 *
1/*
2 * Copyright (c) 1993 Paul Kranenburg
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

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

22 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
23 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
24 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
28 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 *
30 * $Id: ldconfig.c,v 1.6 1994/06/05 19:04:11 ats Exp $
30 * $Id: ldconfig.c,v 1.7 1994/06/15 22:40:56 rich Exp $
31 */
32
33#include <sys/param.h>
34#include <sys/types.h>
35#include <sys/stat.h>
36#include <sys/file.h>
37#include <sys/time.h>
38#include <sys/mman.h>

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

49#include <string.h>
50#include <unistd.h>
51
52#include "ld.h"
53
54#undef major
55#undef minor
56
31 */
32
33#include <sys/param.h>
34#include <sys/types.h>
35#include <sys/stat.h>
36#include <sys/file.h>
37#include <sys/time.h>
38#include <sys/mman.h>

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

49#include <string.h>
50#include <unistd.h>
51
52#include "ld.h"
53
54#undef major
55#undef minor
56
57char *progname;
57extern char *__progname;
58
58static int verbose;
59static int nostd;
60static int justread;
61
62struct shlib_list {
63 /* Internal list of shared libraries found */
64 char *name;
65 char *path;

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

79
80int
81main(argc, argv)
82int argc;
83char *argv[];
84{
85 int i, c;
86 int rval = 0;
59static int verbose;
60static int nostd;
61static int justread;
62
63struct shlib_list {
64 /* Internal list of shared libraries found */
65 char *name;
66 char *path;

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

80
81int
82main(argc, argv)
83int argc;
84char *argv[];
85{
86 int i, c;
87 int rval = 0;
87 extern int optind;
88
88
89 if ((progname = strrchr(argv[0], '/')) == NULL)
90 progname = argv[0];
91 else
92 progname++;
93
94 while ((c = getopt(argc, argv, "rsv")) != EOF) {
95 switch (c) {
96 case 'v':
97 verbose = 1;
98 break;
99 case 's':
100 nostd = 1;
101 break;
102 case 'r':
103 justread = 1;
104 break;
105 default:
89 while ((c = getopt(argc, argv, "rsv")) != EOF) {
90 switch (c) {
91 case 'v':
92 verbose = 1;
93 break;
94 case 's':
95 nostd = 1;
96 break;
97 case 'r':
98 justread = 1;
99 break;
100 default:
106 fprintf(stderr, "Usage: %s [-r] [-s] [-v] [dir ...]\n", progname);
101 fprintf(stderr, "Usage: %s [-r][-s][-v][dir ...]\n",
102 __progname);
107 exit(1);
108 break;
109 }
110 }
111
112 if (justread)
113 return listhints();
114

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

363 int i;
364
365 if ((fd = open(_PATH_LD_HINTS, O_RDONLY, 0)) == -1) {
366 perror(_PATH_LD_HINTS);
367 return -1;
368 }
369
370 msize = PAGSIZ;
103 exit(1);
104 break;
105 }
106 }
107
108 if (justread)
109 return listhints();
110

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

359 int i;
360
361 if ((fd = open(_PATH_LD_HINTS, O_RDONLY, 0)) == -1) {
362 perror(_PATH_LD_HINTS);
363 return -1;
364 }
365
366 msize = PAGSIZ;
371 addr = mmap(0, msize, PROT_READ, MAP_FILE|MAP_COPY, fd, 0);
367 addr = mmap(0, msize, PROT_READ, MAP_COPY, fd, 0);
372
373 if (addr == (caddr_t)-1) {
374 perror(_PATH_LD_HINTS);
375 return -1;
376 }
377
378 hdr = (struct hints_header *)addr;
379 if (HH_BADMAG(*hdr)) {

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

384
385 if (hdr->hh_version != LD_HINTS_VERSION_1) {
386 fprintf(stderr, "Unsupported version: %d\n", hdr->hh_version);
387 return -1;
388 }
389
390 if (hdr->hh_ehints > msize) {
391 if (mmap(addr+msize, hdr->hh_ehints - msize,
368
369 if (addr == (caddr_t)-1) {
370 perror(_PATH_LD_HINTS);
371 return -1;
372 }
373
374 hdr = (struct hints_header *)addr;
375 if (HH_BADMAG(*hdr)) {

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

380
381 if (hdr->hh_version != LD_HINTS_VERSION_1) {
382 fprintf(stderr, "Unsupported version: %d\n", hdr->hh_version);
383 return -1;
384 }
385
386 if (hdr->hh_ehints > msize) {
387 if (mmap(addr+msize, hdr->hh_ehints - msize,
392 PROT_READ, MAP_FILE|MAP_COPY|MAP_FIXED,
388 PROT_READ, MAP_COPY|MAP_FIXED,
393 fd, msize) != (caddr_t)(addr+msize)) {
394
395 perror(_PATH_LD_HINTS);
396 return -1;
397 }
398 }
399 close(fd);
400

--- 29 unchanged lines hidden ---
389 fd, msize) != (caddr_t)(addr+msize)) {
390
391 perror(_PATH_LD_HINTS);
392 return -1;
393 }
394 }
395 close(fd);
396

--- 29 unchanged lines hidden ---