This is the mail archive of the
glibc-cvs@sourceware.org
mailing list for the glibc project.
GNU C Library master sources branch release/2.25/master updated. glibc-2.25-57-g595f287
- From: fw at sourceware dot org
- To: glibc-cvs at sourceware dot org
- Date: 11 Oct 2017 11:09:51 -0000
- Subject: GNU C Library master sources branch release/2.25/master updated. glibc-2.25-57-g595f287
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU C Library master sources".
The branch, release/2.25/master has been updated
via 595f287ae092dd973f6d5fb748cbe31ef7d82b2d (commit)
from 864ea5f6579edfee41f7d4a778807045b5aff66b (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
http://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=595f287ae092dd973f6d5fb748cbe31ef7d82b2d
commit 595f287ae092dd973f6d5fb748cbe31ef7d82b2d
Author: Florian Weimer <fweimer@redhat.com>
Date: Wed Oct 11 13:09:11 2017 +0200
Synchronize support/ infrastructure with master
This commit updates the support/ subdirectory to
commit 84d0e6f05212cabe786cdf00bf3ba5d166d077c0
on the master branch.
diff --git a/support/Makefile b/support/Makefile
index 2ace3fa..027a663 100644
--- a/support/Makefile
+++ b/support/Makefile
@@ -65,6 +65,7 @@ libsupport-routines = \
xchroot \
xclose \
xconnect \
+ xdlfcn \
xdup2 \
xfclose \
xfopen \
diff --git a/support/namespace.h b/support/namespace.h
index 859c2fd..9eddb1a 100644
--- a/support/namespace.h
+++ b/support/namespace.h
@@ -66,7 +66,9 @@ struct support_chroot_configuration
{
/* File contents. The files are not created if the field is
NULL. */
- const char *resolv_conf;
+ const char *resolv_conf; /* /etc/resolv.conf. */
+ const char *hosts; /* /etc/hosts. */
+ const char *host_conf; /* /etc/host.conf. */
};
/* The result of the creation of a chroot. */
@@ -78,8 +80,11 @@ struct support_chroot
/* Path to the chroot directory. */
char *path_chroot;
- /* Path to the /etc/resolv.conf file. */
- char *path_resolv_conf;
+ /* Paths to files in the chroot. These are absolute and outside of
+ the chroot. */
+ char *path_resolv_conf; /* /etc/resolv.conf. */
+ char *path_hosts; /* /etc/hosts. */
+ char *path_host_conf; /* /etc/host.conf. */
};
/* Create a chroot environment. The returned data should be freed
diff --git a/support/support_chroot.c b/support/support_chroot.c
index c0807b3..f3ef551 100644
--- a/support/support_chroot.c
+++ b/support/support_chroot.c
@@ -24,6 +24,23 @@
#include <support/test-driver.h>
#include <support/xunistd.h>
+/* If CONTENTS is not NULL, write it to the file at DIRECTORY/RELPATH,
+ and store the name in *ABSPATH. If CONTENTS is NULL, store NULL in
+ *ABSPATH. */
+static void
+write_file (const char *directory, const char *relpath, const char *contents,
+ char **abspath)
+{
+ if (contents != NULL)
+ {
+ *abspath = xasprintf ("%s/%s", directory, relpath);
+ add_temp_file (*abspath);
+ support_write_file_string (*abspath, contents);
+ }
+ else
+ *abspath = NULL;
+}
+
struct support_chroot *
support_chroot_create (struct support_chroot_configuration conf)
{
@@ -39,15 +56,10 @@ support_chroot_create (struct support_chroot_configuration conf)
xmkdir (path_etc, 0777);
add_temp_file (path_etc);
- if (conf.resolv_conf != NULL)
- {
- /* Create an empty resolv.conf file. */
- chroot->path_resolv_conf = xasprintf ("%s/resolv.conf", path_etc);
- add_temp_file (chroot->path_resolv_conf);
- support_write_file_string (chroot->path_resolv_conf, conf.resolv_conf);
- }
- else
- chroot->path_resolv_conf = NULL;
+ write_file (path_etc, "resolv.conf", conf.resolv_conf,
+ &chroot->path_resolv_conf);
+ write_file (path_etc, "hosts", conf.hosts, &chroot->path_hosts);
+ write_file (path_etc, "host.conf", conf.host_conf, &chroot->path_host_conf);
free (path_etc);
@@ -67,5 +79,7 @@ support_chroot_free (struct support_chroot *chroot)
{
free (chroot->path_chroot);
free (chroot->path_resolv_conf);
+ free (chroot->path_hosts);
+ free (chroot->path_host_conf);
free (chroot);
}
diff --git a/support/support_format_hostent.c b/support/support_format_hostent.c
index 5b5f260..88c85ec 100644
--- a/support/support_format_hostent.c
+++ b/support/support_format_hostent.c
@@ -19,6 +19,7 @@
#include <support/format_nss.h>
#include <arpa/inet.h>
+#include <errno.h>
#include <stdio.h>
#include <support/support.h>
#include <support/xmemstream.h>
@@ -41,10 +42,15 @@ support_format_hostent (struct hostent *h)
{
if (h == NULL)
{
- char *value = support_format_herrno (h_errno);
- char *result = xasprintf ("error: %s\n", value);
- free (value);
- return result;
+ if (h_errno == NETDB_INTERNAL)
+ return xasprintf ("error: NETDB_INTERNAL (errno %d, %m)\n", errno);
+ else
+ {
+ char *value = support_format_herrno (h_errno);
+ char *result = xasprintf ("error: %s\n", value);
+ free (value);
+ return result;
+ }
}
struct xmemstream mem;
diff --git a/support/xdlfcn.c b/support/xdlfcn.c
new file mode 100644
index 0000000..6e39799
--- /dev/null
+++ b/support/xdlfcn.c
@@ -0,0 +1,58 @@
+/* Support functionality for using dlopen/dlclose/dlsym.
+ Copyright (C) 2017 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
+
+#include <support/check.h>
+#include <support/xdlfcn.h>
+
+void *
+xdlopen (const char *filename, int flags)
+{
+ void *dso = dlopen (filename, flags);
+
+ if (dso == NULL)
+ FAIL_EXIT1 ("error: dlopen: %s\n", dlerror ());
+
+ /* Clear any errors. */
+ dlerror ();
+
+ return dso;
+}
+
+void *
+xdlsym (void *handle, const char *symbol)
+{
+ void *sym = dlsym (handle, symbol);
+
+ if (sym == NULL)
+ FAIL_EXIT1 ("error: dlsym: %s\n", dlerror ());
+
+ /* Clear any errors. */
+ dlerror ();
+
+ return sym;
+}
+
+void
+xdlclose (void *handle)
+{
+ if (dlclose (handle) != 0)
+ FAIL_EXIT1 ("error: dlclose: %s\n", dlerror ());
+
+ /* Clear any errors. */
+ dlerror ();
+}
diff --git a/support/xdlfcn.h b/support/xdlfcn.h
new file mode 100644
index 0000000..9bdcb38
--- /dev/null
+++ b/support/xdlfcn.h
@@ -0,0 +1,34 @@
+/* Support functionality for using dlopen/dlclose/dlsym.
+ Copyright (C) 2017 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
+
+#ifndef SUPPORT_DLOPEN_H
+#define SUPPORT_DLOPEN_H
+
+#include <dlfcn.h>
+
+__BEGIN_DECLS
+
+/* Each of these terminates process on failure with relevant error message. */
+void *xdlopen (const char *filename, int flags);
+void *xdlsym (void *handle, const char *symbol);
+void xdlclose (void *handle);
+
+
+__END_DECLS
+
+#endif /* SUPPORT_DLOPEN_H */
-----------------------------------------------------------------------
Summary of changes:
support/Makefile | 1 +
support/namespace.h | 11 ++++++--
support/support_chroot.c | 32 +++++++++++++++++------
support/support_format_hostent.c | 14 +++++++---
support/{support-xstat.c => xdlfcn.c} | 44 +++++++++++++++++++++++++++------
support/{xaccept4.c => xdlfcn.h} | 28 +++++++++++---------
6 files changed, 93 insertions(+), 37 deletions(-)
copy support/{support-xstat.c => xdlfcn.c} (54%)
copy support/{xaccept4.c => xdlfcn.h} (66%)
hooks/post-receive
--
GNU C Library master sources