summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorattilio <attilio@FreeBSD.org>2013-02-26 18:11:43 +0000
committerattilio <attilio@FreeBSD.org>2013-02-26 18:11:43 +0000
commit134623836d0dcb10f5bc79c883bd239098952cca (patch)
tree53b8f81bf2dd71d981f19cb4460f54d0cd525234 /lib
parentcff31deb1a197b29ab976c135fdd01dfb6951a6a (diff)
parent49f99b72515864c7f48e1d57295de7c122876049 (diff)
downloadFreeBSD-src-134623836d0dcb10f5bc79c883bd239098952cca.zip
FreeBSD-src-134623836d0dcb10f5bc79c883bd239098952cca.tar.gz
MFC
Diffstat (limited to 'lib')
-rw-r--r--lib/libc/gen/opendir.c51
-rw-r--r--lib/libexpat/expat_config.h23
-rw-r--r--lib/libexpat/libbsdxml.34
3 files changed, 46 insertions, 32 deletions
diff --git a/lib/libc/gen/opendir.c b/lib/libc/gen/opendir.c
index 2d505fc..a9eb0af 100644
--- a/lib/libc/gen/opendir.c
+++ b/lib/libc/gen/opendir.c
@@ -49,7 +49,7 @@ __FBSDID("$FreeBSD$");
#include "gen-private.h"
#include "telldir.h"
-static DIR * __opendir_common(int, const char *, int);
+static DIR * __opendir_common(int, int);
/*
* Open a directory.
@@ -78,7 +78,7 @@ fdopendir(int fd)
}
if (_fcntl(fd, F_SETFD, FD_CLOEXEC) == -1)
return (NULL);
- return (__opendir_common(fd, NULL, DTF_HIDEW|DTF_NODUP));
+ return (__opendir_common(fd, DTF_HIDEW|DTF_NODUP));
}
DIR *
@@ -92,7 +92,7 @@ __opendir2(const char *name, int flags)
O_RDONLY | O_NONBLOCK | O_DIRECTORY | O_CLOEXEC)) == -1)
return (NULL);
- dir = __opendir_common(fd, name, flags);
+ dir = __opendir_common(fd, flags);
if (dir == NULL) {
saved_errno = errno;
_close(fd);
@@ -113,7 +113,7 @@ opendir_compar(const void *p1, const void *p2)
* Common routine for opendir(3), __opendir2(3) and fdopendir(3).
*/
static DIR *
-__opendir_common(int fd, const char *name, int flags)
+__opendir_common(int fd, int flags)
{
DIR *dirp;
int incr;
@@ -121,6 +121,8 @@ __opendir_common(int fd, const char *name, int flags)
int unionstack;
int fd2;
+ fd2 = -1;
+
if ((dirp = malloc(sizeof(DIR) + sizeof(struct _telldir))) == NULL)
return (NULL);
@@ -165,7 +167,22 @@ __opendir_common(int fd, const char *name, int flags)
* entries into a buffer, sort the buffer, and
* remove duplicate entries by setting the inode
* number to zero.
+ *
+ * We reopen the directory because _getdirentries()
+ * on a MNT_UNION mount modifies the open directory,
+ * making it refer to the lower directory after the
+ * upper directory's entries are exhausted.
+ * This would otherwise break software that uses
+ * the directory descriptor for fchdir or *at
+ * functions, such as fts.c.
*/
+ if ((fd2 = _openat(fd, ".", O_RDONLY | O_CLOEXEC)) == -1) {
+ saved_errno = errno;
+ free(buf);
+ free(dirp);
+ errno = saved_errno;
+ return (NULL);
+ }
do {
/*
@@ -181,7 +198,7 @@ __opendir_common(int fd, const char *name, int flags)
ddptr = buf + (len - space);
}
- n = _getdirentries(fd, ddptr, space, &dirp->dd_seek);
+ n = _getdirentries(fd2, ddptr, space, &dirp->dd_seek);
if (n > 0) {
ddptr += n;
space -= n;
@@ -191,25 +208,8 @@ __opendir_common(int fd, const char *name, int flags)
ddeptr = ddptr;
flags |= __DTF_READALL;
- /*
- * Re-open the directory.
- * This has the effect of rewinding back to the
- * top of the union stack and is needed by
- * programs which plan to fchdir to a descriptor
- * which has also been read -- see fts.c.
- */
- if (flags & DTF_REWIND) {
- if ((fd2 = _open(name, O_RDONLY | O_DIRECTORY |
- O_CLOEXEC)) == -1) {
- saved_errno = errno;
- free(buf);
- free(dirp);
- errno = saved_errno;
- return (NULL);
- }
- (void)_dup2(fd2, fd);
- _close(fd2);
- }
+ _close(fd2);
+ fd2 = -1;
/*
* There is now a buffer full of (possibly) duplicate
@@ -293,7 +293,6 @@ __opendir_common(int fd, const char *name, int flags)
if (dirp->dd_buf == NULL)
goto fail;
dirp->dd_seek = 0;
- flags &= ~DTF_REWIND;
}
dirp->dd_loc = 0;
@@ -310,6 +309,8 @@ __opendir_common(int fd, const char *name, int flags)
fail:
saved_errno = errno;
+ if (fd2 != -1)
+ _close(fd2);
free(dirp);
errno = saved_errno;
return (NULL);
diff --git a/lib/libexpat/expat_config.h b/lib/libexpat/expat_config.h
index 9808129..6deefc4 100644
--- a/lib/libexpat/expat_config.h
+++ b/lib/libexpat/expat_config.h
@@ -45,6 +45,9 @@
/* Define to 1 if you have the <string.h> header file. */
#define HAVE_STRING_H 1
+/* Define to 1 if you have the <sys/param.h> header file. */
+#define HAVE_SYS_PARAM_H 1
+
/* Define to 1 if you have the <sys/stat.h> header file. */
#define HAVE_SYS_STAT_H 1
@@ -54,20 +57,27 @@
/* Define to 1 if you have the <unistd.h> header file. */
#define HAVE_UNISTD_H 1
+/* Define to the sub-directory in which libtool stores uninstalled libraries.
+ */
+#undef LT_OBJDIR
+
/* Define to the address where bug reports for this package should be sent. */
-#define PACKAGE_BUGREPORT "expat-bugs@mail.libexpat.org"
+#define PACKAGE_BUGREPORT "expat-bugs@libexpat.org"
/* Define to the full name of this package. */
#define PACKAGE_NAME "expat"
/* Define to the full name and version of this package. */
-#define PACKAGE_STRING "expat 1.95.5"
+#define PACKAGE_STRING "expat 2.1.0"
/* Define to the one symbol short name of this package. */
#define PACKAGE_TARNAME "expat"
+/* Define to the home page for this package. */
+#define PACKAGE_URL ""
+
/* Define to the version of this package. */
-#define PACKAGE_VERSION "1.95.5"
+#define PACKAGE_VERSION "2.1.0"
/* Define to 1 if you have the ANSI C header files. */
#define STDC_HEADERS 1
@@ -89,11 +99,14 @@
/* Define to make XML Namespaces functionality available. */
#define XML_NS 1
+/* Define to __FUNCTION__ or "" if `__func__' does not conform to ANSI C. */
+/* #undef __func__ */
+
/* Define to empty if `const' does not conform to ANSI C. */
/* #undef const */
-/* Define to `long' if <sys/types.h> does not define. */
+/* Define to `long int' if <sys/types.h> does not define. */
/* #undef off_t */
-/* Define to `unsigned' if <sys/types.h> does not define. */
+/* Define to `unsigned int' if <sys/types.h> does not define. */
/* #undef size_t */
diff --git a/lib/libexpat/libbsdxml.3 b/lib/libexpat/libbsdxml.3
index 555bc9a..04887f0 100644
--- a/lib/libexpat/libbsdxml.3
+++ b/lib/libexpat/libbsdxml.3
@@ -25,7 +25,7 @@
.\"
.\" $FreeBSD$
.\"/
-.Dd December 12, 2009
+.Dd February 26, 2013
.Dt LIBBSDXML 3
.Os
.Sh NAME
@@ -36,7 +36,7 @@
.Sh DESCRIPTION
The
.Nm
-library is a verbatim copy of the eXpat XML library version 2.0.1.
+library is a verbatim copy of the eXpat XML library version 2.1.0.
.Pp
The
.Nm
OpenPOWER on IntegriCloud