From 8215ea780f1f1212da79863ce16956e3339bd88b Mon Sep 17 00:00:00 2001 From: deraadt Date: Tue, 12 Dec 2017 15:33:34 +0000 Subject: [PATCH] ld.so's syscall _dl_* API/ABI doesn't reurn errno, but -errno. Reviewing behaviour artifacts with pledge, I discover a close(-ENOSYS).. ok guenther --- libexec/ld.so/sod.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/libexec/ld.so/sod.c b/libexec/ld.so/sod.c index df41e143751..06ec49bf3aa 100644 --- a/libexec/ld.so/sod.c +++ b/libexec/ld.so/sod.c @@ -1,4 +1,4 @@ -/* $OpenBSD: sod.c,v 1.34 2017/01/24 07:48:37 guenther Exp $ */ +/* $OpenBSD: sod.c,v 1.35 2017/12/12 15:33:34 deraadt Exp $ */ /* * Copyright (c) 1993 Paul Kranenburg @@ -164,8 +164,10 @@ _dl_maphints(void) long hsize = 0; int hfd; - if ((hfd = _dl_open(_PATH_LD_HINTS, O_RDONLY | O_CLOEXEC)) < 0) + if ((hfd = _dl_open(_PATH_LD_HINTS, O_RDONLY | O_CLOEXEC)) < 0) { + hfd = -1; goto bad_hints; + } if (_dl_fstat(hfd, &sb) != 0 || !S_ISREG(sb.st_mode) || sb.st_size < sizeof(struct hints_header) || sb.st_size > LONG_MAX) -- 2.20.1