diff options
author | Theo de Raadt <deraadt@cvs.openbsd.org> | 1996-10-29 01:01:07 +0000 |
---|---|---|
committer | Theo de Raadt <deraadt@cvs.openbsd.org> | 1996-10-29 01:01:07 +0000 |
commit | 7da5bb96ac94cf4977ebe0b429bd94c969722f8c (patch) | |
tree | 8d970881dd005418ca0610340dd2033cba2dec37 /gnu/usr.bin/ld/ldconfig/ldconfig.c | |
parent | ed5ba5ef1f31f61b2921bfbf7ea5c1f6dd0a2ac9 (diff) |
mktemp is evil
Diffstat (limited to 'gnu/usr.bin/ld/ldconfig/ldconfig.c')
-rw-r--r-- | gnu/usr.bin/ld/ldconfig/ldconfig.c | 13 |
1 files changed, 4 insertions, 9 deletions
diff --git a/gnu/usr.bin/ld/ldconfig/ldconfig.c b/gnu/usr.bin/ld/ldconfig/ldconfig.c index 7c1eb95ac69..4e0ca0497e9 100644 --- a/gnu/usr.bin/ld/ldconfig/ldconfig.c +++ b/gnu/usr.bin/ld/ldconfig/ldconfig.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ldconfig.c,v 1.3 1996/06/28 22:02:27 deraadt Exp $ */ +/* $OpenBSD: ldconfig.c,v 1.4 1996/10/29 01:01:06 deraadt Exp $ */ /* * Copyright (c) 1993,1995 Paul Kranenburg @@ -361,17 +361,12 @@ buildhints() errx(1, "str_index(%d) != strtab_sz(%d)", str_index, strtab_sz); } - tmpfile = concat(_PATH_LD_HINTS, ".XXXXXX", ""); - if ((tmpfile = mktemp(tmpfile)) == NULL) { + tmpfile = concat(_PATH_LD_HINTS, ".XXXXXXXXXX", ""); + if ((fd = mkstemp(tmpfile)) == -1) { warn("%s", tmpfile); return -1; } - - umask(0); /* Create with exact permissions */ - if ((fd = open(tmpfile, O_RDWR|O_CREAT|O_TRUNC, 0444)) == -1) { - warn("%s", _PATH_LD_HINTS); - return -1; - } + fchmod(fd, 0444); if (write(fd, &hdr, sizeof(struct hints_header)) != sizeof(struct hints_header)) { |