This is the mail archive of the
glibc-cvs@sourceware.org
mailing list for the glibc project.
[glibc/zack/no-nested-includes] fixup for sys/un.h: don't include string.h
- From: Zack Weinberg <zack at sourceware dot org>
- To: glibc-cvs at sourceware dot org
- Date: 18 Jun 2019 15:34:32 -0000
- Subject: [glibc/zack/no-nested-includes] fixup for sys/un.h: don't include string.h
https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=c52e60d2d7fd286c65d76c67eec04ae6e37775b1
commit c52e60d2d7fd286c65d76c67eec04ae6e37775b1
Author: Zack Weinberg <zackw@panix.com>
Date: Sun May 26 11:02:27 2019 -0400
fixup for sys/un.h: don't include string.h
1) For a valid prototype of strlen, sys/un.h must define size_t.
2) Some old RPC code was relying on sys/un.h to provide all of string.h.
* socket/sys/un.h: Include stddef.h for size_t.
* nis/nis_domain_of.c, nis/yp_xdr.c, sunrpc/svc.c: Include string.h.
Diff:
---
nis/nis_domain_of.c | 1 +
nis/yp_xdr.c | 1 +
socket/sys/un.h | 3 +++
sunrpc/svc.c | 1 +
4 files changed, 6 insertions(+)
diff --git a/nis/nis_domain_of.c b/nis/nis_domain_of.c
index 44c5b04..da26df3 100644
--- a/nis/nis_domain_of.c
+++ b/nis/nis_domain_of.c
@@ -17,6 +17,7 @@
<http://www.gnu.org/licenses/>. */
#include <rpcsvc/nis.h>
+#include <string.h>
#include <shlib-compat.h>
nis_name
diff --git a/nis/yp_xdr.c b/nis/yp_xdr.c
index 3b57673..4c9f1d2 100644
--- a/nis/yp_xdr.c
+++ b/nis/yp_xdr.c
@@ -31,6 +31,7 @@
#include <rpcsvc/yp.h>
#include <rpcsvc/ypclnt.h>
+#include <string.h>
#include <shlib-compat.h>
/* The NIS v2 protocol suggests 1024 bytes as a maximum length of all fields.
diff --git a/socket/sys/un.h b/socket/sys/un.h
index 8097436..104d28f 100644
--- a/socket/sys/un.h
+++ b/socket/sys/un.h
@@ -34,6 +34,9 @@ struct sockaddr_un
#ifdef __USE_MISC
+#define __need_size_t
+#include <stddef.h>
+
extern size_t strlen (const char *__s)
__THROW __attribute_pure__ __nonnull ((1));
diff --git a/sunrpc/svc.c b/sunrpc/svc.c
index 95ecfbb..8042019 100644
--- a/sunrpc/svc.c
+++ b/sunrpc/svc.c
@@ -53,6 +53,7 @@
*/
#include <errno.h>
+#include <string.h>
#include <unistd.h>
#include <rpc/rpc.h>
#include <rpc/svc.h>