From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/11409 Path: news.gmane.org!.POSTED!not-for-mail From: "A. Wilcox" Newsgroups: gmane.linux.lib.musl.general Subject: [PATCH 2/3] confstr: don't give empty strings for unset values Date: Fri, 9 Jun 2017 00:26:17 -0500 Message-ID: <20170609052618.5875-3-awilfox@adelielinux.org> References: <5898F7D9.7090403@adelielinux.org> <20170609052618.5875-1-awilfox@adelielinux.org> Reply-To: musl@lists.openwall.com NNTP-Posting-Host: blaine.gmane.org X-Trace: blaine.gmane.org 1496986051 5168 195.159.176.226 (9 Jun 2017 05:27:31 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Fri, 9 Jun 2017 05:27:31 +0000 (UTC) Cc: "A. Wilcox" To: musl@lists.openwall.com Original-X-From: musl-return-11422-gllmg-musl=m.gmane.org@lists.openwall.com Fri Jun 09 07:27:28 2017 Return-path: Envelope-to: gllmg-musl@m.gmane.org Original-Received: from mother.openwall.net ([195.42.179.200]) by blaine.gmane.org with smtp (Exim 4.84_2) (envelope-from ) id 1dJCSF-00017v-1Q for gllmg-musl@m.gmane.org; Fri, 09 Jun 2017 07:27:27 +0200 Original-Received: (qmail 5187 invoked by uid 550); 9 Jun 2017 05:27:27 -0000 Mailing-List: contact musl-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-ID: Original-Received: (qmail 3915 invoked from network); 9 Jun 2017 05:27:24 -0000 X-Mailer: git-send-email 2.10.0 In-Reply-To: <20170609052618.5875-1-awilfox@adelielinux.org> Xref: news.gmane.org gmane.linux.lib.musl.general:11409 Archived-At: From: "A. Wilcox" If confstr(3) returns an empty string, that means the implementation supports the configuration and simply needs no setting. Some values should actually be unset on musl. This change ensures that configurations not supported by musl do not have values. --- src/conf/confstr.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/conf/confstr.c b/src/conf/confstr.c index 02cb1aa..c899abd 100644 --- a/src/conf/confstr.c +++ b/src/conf/confstr.c @@ -11,6 +11,19 @@ size_t confstr(int name, char *buf, size_t len) errno = EINVAL; return 0; } + + if (name == _CS_POSIX_V7_WIDTH_RESTRICTED_ENVS || + // Since sysconf _SC_V7_ILP32_OFF32 = -1 + name == _CS_POSIX_V7_ILP32_OFF32_CFLAGS || + name == _CS_POSIX_V7_ILP32_OFF32_LDFLAGS || + name == _CS_POSIX_V7_ILP32_OFF32_LIBS || + // Since sysconf _SC_V7_LPBIG_OFFBIG = -1 + name == _CS_POSIX_V7_LPBIG_OFFBIG_CFLAGS || + name == _CS_POSIX_V7_LPBIG_OFFBIG_LDFLAGS || + name == _CS_POSIX_V7_LPBIG_OFFBIG_LIBS) { + return 0; + } + // snprintf is overkill but avoid wasting code size to implement // this completely useless function and its truncation semantics return snprintf(buf, len, "%s", s) + 1; -- 2.10.0