Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Fri,  9 Jun 2017 00:26:17 -0500
From: "A. Wilcox" <awilfox@...lielinux.org>
To: musl@...ts.openwall.com
Cc: "A. Wilcox" <AWilcox@...cox-Tech.com>
Subject: [PATCH 2/3] confstr: don't give empty strings for unset values

From: "A. Wilcox" <AWilcox@...cox-Tech.com>

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

Powered by blists - more mailing lists

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.