| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
1 | /* $NetBSD: ldconfig.c,v 1.44 2008/04/28 20:23:08 martin Exp $ */ | | 1 | /* $NetBSD: ldconfig.c,v 1.45 2009/03/17 00:52:47 lukem Exp $ */ |
2 | | | 2 | |
3 | /*- | | 3 | /*- |
4 | * Copyright (c) 1998 The NetBSD Foundation, Inc. | | 4 | * Copyright (c) 1998 The NetBSD Foundation, Inc. |
5 | * All rights reserved. | | 5 | * All rights reserved. |
6 | * | | 6 | * |
7 | * This code is derived from software contributed to The NetBSD Foundation | | 7 | * This code is derived from software contributed to The NetBSD Foundation |
8 | * by Paul Kranenburg. | | 8 | * by Paul Kranenburg. |
9 | * | | 9 | * |
10 | * Redistribution and use in source and binary forms, with or without | | 10 | * Redistribution and use in source and binary forms, with or without |
11 | * modification, are permitted provided that the following conditions | | 11 | * modification, are permitted provided that the following conditions |
12 | * are met: | | 12 | * are met: |
13 | * 1. Redistributions of source code must retain the above copyright | | 13 | * 1. Redistributions of source code must retain the above copyright |
14 | * notice, this list of conditions and the following disclaimer. | | 14 | * notice, this list of conditions and the following disclaimer. |
| @@ -21,27 +21,27 @@ | | | @@ -21,27 +21,27 @@ |
21 | * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | | 21 | * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR |
22 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS | | 22 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS |
23 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | | 23 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
24 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | | 24 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
25 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | | 25 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
26 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | | 26 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
27 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | | 27 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
28 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | | 28 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
29 | * POSSIBILITY OF SUCH DAMAGE. | | 29 | * POSSIBILITY OF SUCH DAMAGE. |
30 | */ | | 30 | */ |
31 | #include <sys/cdefs.h> | | 31 | #include <sys/cdefs.h> |
32 | | | 32 | |
33 | #ifndef lint | | 33 | #ifndef lint |
34 | __RCSID("$NetBSD: ldconfig.c,v 1.44 2008/04/28 20:23:08 martin Exp $"); | | 34 | __RCSID("$NetBSD: ldconfig.c,v 1.45 2009/03/17 00:52:47 lukem Exp $"); |
35 | #endif | | 35 | #endif |
36 | | | 36 | |
37 | | | 37 | |
38 | #include <sys/param.h> | | 38 | #include <sys/param.h> |
39 | #include <sys/types.h> | | 39 | #include <sys/types.h> |
40 | #include <sys/stat.h> | | 40 | #include <sys/stat.h> |
41 | #include <sys/file.h> | | 41 | #include <sys/file.h> |
42 | #include <sys/time.h> | | 42 | #include <sys/time.h> |
43 | #include <sys/mman.h> | | 43 | #include <sys/mman.h> |
44 | #include <a.out.h> | | 44 | #include <a.out.h> |
45 | #include <ctype.h> | | 45 | #include <ctype.h> |
46 | #include <dirent.h> | | 46 | #include <dirent.h> |
47 | #include <err.h> | | 47 | #include <err.h> |
| @@ -458,27 +458,27 @@ buildhints(void) | | | @@ -458,27 +458,27 @@ buildhints(void) |
458 | } | | 458 | } |
459 | | | 459 | |
460 | tempfile = concat(_PATH_LD_HINTS, ".XXXXXX", ""); | | 460 | tempfile = concat(_PATH_LD_HINTS, ".XXXXXX", ""); |
461 | if ((fd = mkstemp(tempfile)) == -1) { | | 461 | if ((fd = mkstemp(tempfile)) == -1) { |
462 | warn("%s", tempfile); | | 462 | warn("%s", tempfile); |
463 | goto out; | | 463 | goto out; |
464 | } | | 464 | } |
465 | | | 465 | |
466 | if (write(fd, &hdr, sizeof(struct hints_header)) != | | 466 | if (write(fd, &hdr, sizeof(struct hints_header)) != |
467 | sizeof(struct hints_header)) { | | 467 | sizeof(struct hints_header)) { |
468 | warn("%s", _PATH_LD_HINTS); | | 468 | warn("%s", _PATH_LD_HINTS); |
469 | goto out; | | 469 | goto out; |
470 | } | | 470 | } |
471 | if (write(fd, blist, hdr.hh_nbucket * sizeof(struct hints_bucket)) != | | 471 | if ((size_t)write(fd, blist, hdr.hh_nbucket * sizeof(struct hints_bucket)) != |
472 | hdr.hh_nbucket * sizeof(struct hints_bucket)) { | | 472 | hdr.hh_nbucket * sizeof(struct hints_bucket)) { |
473 | warn("%s", _PATH_LD_HINTS); | | 473 | warn("%s", _PATH_LD_HINTS); |
474 | goto out; | | 474 | goto out; |
475 | } | | 475 | } |
476 | if (write(fd, strtab, strtab_sz) != strtab_sz) { | | 476 | if (write(fd, strtab, strtab_sz) != strtab_sz) { |
477 | warn("%s", _PATH_LD_HINTS); | | 477 | warn("%s", _PATH_LD_HINTS); |
478 | goto out; | | 478 | goto out; |
479 | } | | 479 | } |
480 | if (fchmod(fd, 0444) == -1) { | | 480 | if (fchmod(fd, 0444) == -1) { |
481 | warn("%s", _PATH_LD_HINTS); | | 481 | warn("%s", _PATH_LD_HINTS); |
482 | goto out; | | 482 | goto out; |
483 | } | | 483 | } |
484 | if (close(fd) != 0) { | | 484 | if (close(fd) != 0) { |