diff options
Diffstat (limited to 'sbin/ldconfig')
-rw-r--r-- | sbin/ldconfig/ldconfig.c | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/sbin/ldconfig/ldconfig.c b/sbin/ldconfig/ldconfig.c index 01bbe1f..07e5abc 100644 --- a/sbin/ldconfig/ldconfig.c +++ b/sbin/ldconfig/ldconfig.c @@ -465,17 +465,13 @@ buildhints() errx(1, "str_index(%d) != strtab_sz(%d)", str_index, strtab_sz); } - tmpfile = concat(hints_file, ".XXXXXX", ""); - if ((tmpfile = mktemp(tmpfile)) == NULL) { - warn("%s", tmpfile); - return -1; - } - + tmpfile = concat(hints_file, ".XXXXXXXXXX", ""); umask(0); /* Create with exact permissions */ - if ((fd = open(tmpfile, O_RDWR|O_CREAT|O_TRUNC, 0444)) == -1) { - warn("%s", hints_file); + if ((fd = mkstemp(tmpfile)) == -1) { + warn("%s", tmpfile); return -1; } + fchmod(fd, 0444); if (write(fd, &hdr, sizeof(struct hints_header)) != sizeof(struct hints_header)) { |