summaryrefslogtreecommitdiff
path: root/libexec/ld.so
diff options
context:
space:
mode:
authorcheloha <cheloha@cvs.openbsd.org>2018-06-08 19:24:47 +0000
committercheloha <cheloha@cvs.openbsd.org>2018-06-08 19:24:47 +0000
commitd2c533db77b78e00ee105dd224f519d9fae3b069 (patch)
tree1e1e24052f79d3a7c0ac838f9e53396e4b2a32a2 /libexec/ld.so
parentf7fad7987baffd3dd04eaf2a5412828baa3b8694 (diff)
Bail out if fchmod(2) fails.
Don't quietly install ld.so.hints with mode 0600 because this adds overhead to shlib lookup for non-root processes. From Nan Xiao. ok guenther@
Diffstat (limited to 'libexec/ld.so')
-rw-r--r--libexec/ld.so/ldconfig/ldconfig.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/libexec/ld.so/ldconfig/ldconfig.c b/libexec/ld.so/ldconfig/ldconfig.c
index 6511c8a218d..96c3ff723c6 100644
--- a/libexec/ld.so/ldconfig/ldconfig.c
+++ b/libexec/ld.so/ldconfig/ldconfig.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ldconfig.c,v 1.37 2018/04/26 12:42:50 guenther Exp $ */
+/* $OpenBSD: ldconfig.c,v 1.38 2018/06/08 19:24:46 cheloha Exp $ */
/*
* Copyright (c) 1993,1995 Paul Kranenburg
@@ -386,7 +386,10 @@ buildhints(void)
warn("%s", tmpfilenam);
goto out;
}
- fchmod(fd, 0444);
+ if (fchmod(fd, 0444) == -1) {
+ warn("%s: failed to change mode", tmpfilenam);
+ goto out;
+ }
if (write(fd, &hdr, sizeof(struct hints_header)) !=
sizeof(struct hints_header)) {