% Load plain if necessary, i.e., if running under initex.
\expandafter\ifx\csname fmtname\endcsname\relax\input plain\fi
%
-\def\texinfoversion{2015-05-26.15}
+\def\texinfoversion{2015-06-01.15}
%
% Copyright 1985, 1986, 1988, 1990, 1991, 1992, 1993, 1994, 1995,
% 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
% Avoid "undefined control sequence" errors.
\def\lastchapterdefs{}
\def\lastsectiondefs{}
+\def\lastsection{}
\def\prevchapterdefs{}
\def\prevsectiondefs{}
\def\lastcolordefs{}
\long\def\nillm@{\nil@}%
% This macro is expanded during the Texinfo macro expansion, not during its
-% definition. It gets all the arguments values and assigns them to macros
+% definition. It gets all the arguments' values and assigns them to macros
% macarg.ARGNAME
%
% #1 is the macro name
int get_permissions (const char *, int, mode_t, struct permission_context *);
int set_permissions (struct permission_context *, const char *, int);
-void free_permission_context (struct permission_context *);
+void free_permission_context (struct permission_context *)
+#if ! (defined USE_ACL && (HAVE_ACL_GET_FILE || defined GETACL))
+ _GL_ATTRIBUTE_CONST
+#endif
+ ;
_GL_INLINE_HEADER_END
get_permissions (const char *name, int desc, mode_t mode,
struct permission_context *ctx)
{
- memset (ctx, 0, sizeof(*ctx));
+ memset (ctx, 0, sizeof *ctx);
ctx->mode = mode;
#if USE_ACL && HAVE_ACL_GET_FILE
#elif USE_ACL && HAVE_GETACL /* HP-UX */
- int ret;
-
- if (desc != -1)
- ret = fgetacl (desc, NACLENTRIES, ctx->entries);
- else
- ret = getacl (name, NACLENTRIES, ctx->entries);
- if (ret < 0)
- {
- if (errno == ENOSYS || errno == EOPNOTSUPP || errno == ENOTSUP)
- ret = 0;
- else
- return -1;
- }
- else if (ret > NACLENTRIES)
- /* If NACLENTRIES cannot be trusted, use dynamic memory allocation. */
- abort ();
- ctx->count = ret;
+ {
+ int ret;
+
+ if (desc != -1)
+ ret = fgetacl (desc, NACLENTRIES, ctx->entries);
+ else
+ ret = getacl (name, NACLENTRIES, ctx->entries);
+ if (ret < 0)
+ {
+ if (errno == ENOSYS || errno == EOPNOTSUPP || errno == ENOTSUP)
+ ret = 0;
+ else
+ return -1;
+ }
+ else if (ret > NACLENTRIES)
+ /* If NACLENTRIES cannot be trusted, use dynamic memory allocation. */
+ abort ();
+ ctx->count = ret;
# if HAVE_ACLV_H
- ret = acl ((char *) name, ACL_GET, NACLVENTRIES, ctx->aclv_entries);
- if (ret < 0)
- {
- if (errno == ENOSYS || errno == EOPNOTSUPP || errno == EINVAL)
- ret = 0;
- else
- return -2;
- }
- else if (ret > NACLVENTRIES)
- /* If NACLVENTRIES cannot be trusted, use dynamic memory allocation. */
+ ret = acl ((char *) name, ACL_GET, NACLVENTRIES, ctx->aclv_entries);
+ if (ret < 0)
+ {
+ if (errno == ENOSYS || errno == EOPNOTSUPP || errno == EINVAL)
+ ret = 0;
+ else
+ return -2;
+ }
+ else if (ret > NACLVENTRIES)
+ /* If NACLVENTRIES cannot be trusted, use dynamic memory allocation. */
abort ();
- ctx->aclv_count = ret;
+ ctx->aclv_count = ret;
# endif
+ }
#elif USE_ACL && HAVE_ACLX_GET && ACL_AIX_WIP /* AIX */
#elif USE_ACL && HAVE_STATACL /* older AIX */
- if (desc != -1)
- ret = fstatacl (desc, STX_NORMAL, &ctx->u.a, sizeof (ctx->u));
- else
- ret = statacl (name, STX_NORMAL, &ctx->u.a, sizeof (ctx->u));
- if (ret == 0)
- ctx->have_u = true;
+ {
+ int ret;
+ if (desc != -1)
+ ret = fstatacl (desc, STX_NORMAL, &ctx->u.a, sizeof ctx->u);
+ else
+ ret = statacl ((char *) name, STX_NORMAL, &ctx->u.a, sizeof ctx->u);
+ if (ret == 0)
+ ctx->have_u = true;
+ }
#elif USE_ACL && HAVE_ACLSORT /* NonStop Kernel */
- int ret;
-
- ret = acl ((char *) name, ACL_GET, NACLENTRIES, ctx->entries);
- if (ret < 0)
- return -1;
- else if (ret > NACLENTRIES)
- /* If NACLENTRIES cannot be trusted, use dynamic memory allocation. */
- abort ();
- ctx->count = ret;
+ {
+ int ret = acl ((char *) name, ACL_GET, NACLENTRIES, ctx->entries);
+ if (ret < 0)
+ return -1;
+ else if (ret > NACLENTRIES)
+ /* If NACLENTRIES cannot be trusted, use dynamic memory allocation. */
+ abort ();
+ ctx->count = ret;
+ }
#endif
## begin gnulib module acl-permissions
-libgnu_a_SOURCES += acl-errno-valid.c acl-internal.c \
- get-permissions.c set-permissions.c
+libgnu_a_SOURCES += acl-errno-valid.c acl-internal.c get-permissions.c set-permissions.c
EXTRA_DIST += acl-internal.h acl.h acl_entries.c
#include <config.h>
+#include <errno.h>
#include <unistd.h>
+#include <string.h>
+#include <sys/stat.h>
#if HAVE_READLINKAT
ssize_t
rpl_readlinkat (int fd, char const *file, char *buf, size_t len)
{
+# if READLINK_TRAILING_SLASH_BUG
+ size_t file_len = strlen (file);
+ if (file_len && file[file_len - 1] == '/')
+ {
+ /* Even if FILE without the slash is a symlink to a directory,
+ both lstat() and stat() must resolve the trailing slash to
+ the directory rather than the symlink. We can therefore
+ safely use stat() to distinguish between EINVAL and
+ ENOTDIR/ENOENT, avoiding extra overhead of rpl_lstat(). */
+ struct stat st;
+ if (stat (file, &st) == 0)
+ errno = EINVAL;
+ return -1;
+ }
+# endif /* READLINK_TRAILING_SLASH_BUG */
return readlinkat (fd, file, buf, len);
}
if (desc != -1)
ret = fchacl (desc, &ctx->u.a, ctx->u.a.acl_len);
else
- ret = chacl (name, &ctx->u.a, ctx->u.a.acl_len);
+ ret = chacl ((char *) name, &ctx->u.a, ctx->u.a.acl_len);
if (ret < 0)
{
if (errno == ENOSYS && from_mode)
so any use of gets warrants an unconditional warning; besides, C11
removed it. */
#undef gets
-#if HAVE_RAW_DECL_GETS
+#if HAVE_RAW_DECL_GETS && !defined __cplusplus
_GL_WARN_ON_USE (gets, "gets is a security hole - use fgets instead");
#endif
-
#if @GNULIB_OBSTACK_PRINTF@ || @GNULIB_OBSTACK_PRINTF_POSIX@
struct obstack;
/* Grow an obstack with formatted output. Return the number of
# acl.m4 - check for access control list (ACL) primitives
-# serial 20
+# serial 21
# Copyright (C) 2002, 2004-2015 Free Software Foundation, Inc.
# This file is free software; the Free Software Foundation
[
AC_REQUIRE([gl_FUNC_ACL_ARG])
if test "$enable_acl" != no; then
- AC_CHECK_HEADERS([linux/xattr.h])
- AC_CHECK_HEADERS([sys/xattr.h],
- [AC_CHECK_FUNCS([getxattr])])
+ AC_CACHE_CHECK([for getxattr with XATTR_NAME_POSIX_ACL macros],
+ [gl_cv_getxattr_with_posix_acls],
+ [gl_cv_getxattr_with_posix_acls=no
+ AC_LINK_IFELSE(
+ [AC_LANG_PROGRAM(
+ [[#include <sys/types.h>
+ #include <sys/xattr.h>
+ #include <linux/xattr.h>
+ ]],
+ [[ssize_t a = getxattr (".", XATTR_NAME_POSIX_ACL_ACCESS, 0, 0);
+ ssize_t b = getxattr (".", XATTR_NAME_POSIX_ACL_DEFAULT, 0, 0);
+ return a < 0 || b < 0;
+ ]])],
+ [gl_cv_getxattr_with_posix_acls=yes])])
fi
- if test "$ac_cv_header_sys_xattr_h,$ac_cv_func_getxattr" = yes,yes; then
+ if test "$gl_cv_getxattr_with_posix_acls" = yes; then
LIB_HAS_ACL=
+ AC_DEFINE([GETXATTR_WITH_POSIX_ACLS], 1,
+ [Define to 1 if getxattr works with XATTR_NAME_POSIX_ACL_ACCESS
+ and XATTR_NAME_POSIX_ACL_DEFAULT.])
else
dnl Set gl_need_lib_has_acl to a nonempty value, so that any
dnl later gl_FUNC_ACL call will set LIB_HAS_ACL=$LIB_ACL.
-# pthread_sigmask.m4 serial 15
+# pthread_sigmask.m4 serial 16
dnl Copyright (C) 2011-2015 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
[gl_cv_func_pthread_sigmask_in_LIBMULTITHREAD=no])
LIBS="$gl_save_LIBS"
])
+ if test $gl_cv_func_pthread_sigmask_in_LIBMULTITHREAD = yes; then
+ AC_CACHE_CHECK([whether pthread_sigmask is only a macro],
+ [gl_cv_func_pthread_sigmask_is_macro],
+ [gl_save_LIBS="$LIBS"
+ LIBS="$LIBS $LIBMULTITHREAD"
+ AC_LINK_IFELSE(
+ [AC_LANG_PROGRAM(
+ [[#include <pthread.h>
+ #include <signal.h>
+ #undef pthread_sigmask
+ ]],
+ [[return pthread_sigmask (0, (sigset_t *) 0, (sigset_t *) 0);]])
+ ],
+ [gl_cv_func_pthread_sigmask_is_macro=no],
+ [gl_cv_func_pthread_sigmask_is_macro=yes])
+ LIBS="$gl_save_LIBS"
+ ])
+ if test $gl_cv_func_pthread_sigmask_is_macro = yes; then
+ dnl On MinGW pthread_sigmask is just a macro which always returns 0.
+ dnl It does not exist as a real function, which is required by POSIX.
+ REPLACE_PTHREAD_SIGMASK=1
+ gl_cv_func_pthread_sigmask_in_LIBMULTITHREAD=no
+ fi
+ fi
if test $gl_cv_func_pthread_sigmask_in_LIBMULTITHREAD = yes; then
dnl pthread_sigmask is available with -pthread or -lpthread.
LIB_PTHREAD_SIGMASK="$LIBMULTITHREAD"
-# serial 4
+# serial 5
# See if we need to provide readlinkat replacement.
dnl Copyright (C) 2009-2015 Free Software Foundation, Inc.
AC_REQUIRE([gl_UNISTD_H_DEFAULTS])
AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
AC_CHECK_FUNCS_ONCE([readlinkat])
+ AC_REQUIRE([gl_FUNC_READLINK])
if test $ac_cv_func_readlinkat = no; then
HAVE_READLINKAT=0
else
ssize_t readlinkat (int, char const *, char *, size_t);]])],
[gl_cv_decl_readlinkat_works=yes],
[gl_cv_decl_readlinkat_works=no])])
- if test "$gl_cv_decl_readlink_works" != yes; then
- REPLACE_READLINKAT=1
- fi
+ # Assume readinkat has the same trailing slash bug as readlink,
+ # as is the case on Mac Os X 10.10
+ case "$gl_cv_func_readlink_works" in
+ *yes)
+ if test "$gl_cv_decl_readlinkat_works" != yes; then
+ REPLACE_READLINKAT=1
+ fi
+ ;;
+ *)
+ REPLACE_READLINKAT=1
+ ;;
+ esac
fi
])