summaryrefslogtreecommitdiff
path: root/m4
diff options
context:
space:
mode:
authorPaul Eggert <eggert@cs.ucla.edu>2016-01-24 14:50:47 -0800
committerPaul Eggert <eggert@cs.ucla.edu>2016-01-24 14:51:22 -0800
commit1698036a43d9e2c55ead6216ea7156df8615da47 (patch)
tree60bb61c907536ebc38c6b301fd754028b8a9b542 /m4
parentfbce4757a874cc43806eb41b8637538b101c3c69 (diff)
Merge from gnulib
This incorporates: 2016-01-24 openat_proc_name: fix last '/' overwritten on OS/2 kLIBC 2016-01-24 closedir, dirfd, opendir: port to OpenSolaris 5.10 2016-01-15 detect utimes() correctly on OS/2 kLIBC 2016-01-15 openat_proc_name: port to OS/2 kLIBC 2016-01-14 stdint: check _INTPTR_T_DECLARED for intptr_t etc. 2016-01-14 opendir, closedir, dirfd, fdopendir: port to OS/2 kLIBC 2016-01-14 dup, dup2, fcntl: support a directory fd on OS/2 kLIBC 2016-01-14 binary-io: don't put fd in binary mode if a console on EMX 2016-01-14 sig2str: list all signals on FreeBSD >= 7 2016-01-13 acl-permissions: port to USE_ACL==0 platforms 2016-01-12 mktime: rename macro to avoid glibc clash 2016-01-12 Port "$@" to OpenIndiana ksh93 2016-01-12 Port Universal Time settings to strict POSIX * build-aux/gitlog-to-changelog, build-aux/update-copyright: * doc/misc/texinfo.tex, lib/acl-internal.c, lib/acl-internal.h: * lib/binary-io.h, lib/dirent.in.h, lib/dirfd.c, lib/dup2.c: * lib/fcntl.c, lib/fdopendir.c, lib/mktime.c, lib/openat-proc.c: * lib/sig2str.h, lib/stdint.in.h, m4/dirfd.m4, m4/dup2.m4: * m4/fcntl.m4, m4/utimes.m4: Copy from gnulib. * m4/gnulib-comp.m4: Regenerate.
Diffstat (limited to 'm4')
-rw-r--r--m4/dirfd.m416
-rw-r--r--m4/dup2.m414
-rw-r--r--m4/fcntl.m413
-rw-r--r--m4/gnulib-comp.m43
-rw-r--r--m4/utimes.m422
5 files changed, 54 insertions, 14 deletions
diff --git a/m4/dirfd.m4 b/m4/dirfd.m4
index e9532e60a9..1d7cb080d8 100644
--- a/m4/dirfd.m4
+++ b/m4/dirfd.m4
@@ -1,4 +1,4 @@
-# serial 22 -*- Autoconf -*-
+# serial 24 -*- Autoconf -*-
dnl Find out how to get the file descriptor associated with an open DIR*.
@@ -35,13 +35,15 @@ AC_DEFUN([gl_FUNC_DIRFD],
gl_cv_func_dirfd_macro=yes,
gl_cv_func_dirfd_macro=no)])
- # Use the replacement only if we have no function or macro with that name.
- if test $ac_cv_func_dirfd = no && test $gl_cv_func_dirfd_macro = no; then
- if test $ac_cv_have_decl_dirfd = yes; then
- # If the system declares dirfd already, let's declare rpl_dirfd instead.
+ # Use the replacement if we have no function or macro with that name,
+ # or if OS/2 kLIBC whose dirfd() does not work.
+ # Replace only if the system declares dirfd already.
+ case $ac_cv_func_dirfd,$gl_cv_func_dirfd_macro,$host_os,$ac_cv_have_decl_dirfd in
+ no,no,*,yes | *,*,os2*,yes)
REPLACE_DIRFD=1
- fi
- fi
+ AC_DEFINE([REPLACE_DIRFD], [1],
+ [Define to 1 if gnulib's dirfd() replacement is used.]);;
+ esac
])
dnl Prerequisites of lib/dirfd.c.
diff --git a/m4/dup2.m4 b/m4/dup2.m4
index 63d6d8eb6e..5b68312b1e 100644
--- a/m4/dup2.m4
+++ b/m4/dup2.m4
@@ -1,4 +1,4 @@
-#serial 24
+#serial 25
dnl Copyright (C) 2002, 2005, 2007, 2009-2016 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
@@ -62,6 +62,16 @@ AC_DEFUN([gl_FUNC_DUP2],
result |= 32;
dup2 (2, 255);
dup2 (2, 256);
+ /* On OS/2 kLIBC, dup2() does not work on a directory fd. */
+ {
+ int fd = open (".", O_RDONLY);
+ if (fd == -1)
+ result |= 64;
+ else if (dup2 (fd, fd + 1) == -1)
+ result |= 128;
+
+ close (fd);
+ }
return result;]])
],
[gl_cv_func_dup2_works=yes], [gl_cv_func_dup2_works=no],
@@ -78,6 +88,8 @@ AC_DEFUN([gl_FUNC_DUP2],
gl_cv_func_dup2_works="guessing no" ;;
*-android*) # implemented using dup3(), which fails if oldfd == newfd
gl_cv_func_dup2_works="guessing no" ;;
+ os2*) # on OS/2 kLIBC, dup2() does not work on a directory fd.
+ gl_cv_func_dup2_works="guessing no" ;;
*) gl_cv_func_dup2_works="guessing yes" ;;
esac])
])
diff --git a/m4/fcntl.m4 b/m4/fcntl.m4
index 0037e5fb65..bb61470b2e 100644
--- a/m4/fcntl.m4
+++ b/m4/fcntl.m4
@@ -1,4 +1,4 @@
-# fcntl.m4 serial 8
+# fcntl.m4 serial 9
dnl Copyright (C) 2009-2016 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
@@ -54,6 +54,17 @@ AC_DEFUN([gl_FUNC_FCNTL],
if (errno != EINVAL) result |= 2;
if (fcntl (0, F_DUPFD, bad_fd) != -1) result |= 4;
if (errno != EINVAL) result |= 8;
+ /* On OS/2 kLIBC, F_DUPFD does not work on a directory fd */
+ {
+ int fd;
+ fd = open (".", O_RDONLY);
+ if (fd == -1)
+ result |= 16;
+ else if (fcntl (fd, F_DUPFD, STDERR_FILENO + 1) == -1)
+ result |= 32;
+
+ close (fd);
+ }
return result;]])],
[gl_cv_func_fcntl_f_dupfd_works=yes],
[gl_cv_func_fcntl_f_dupfd_works=no],
diff --git a/m4/gnulib-comp.m4 b/m4/gnulib-comp.m4
index 27ca70a0d0..547af6641a 100644
--- a/m4/gnulib-comp.m4
+++ b/m4/gnulib-comp.m4
@@ -436,7 +436,8 @@ AC_DEFUN([gl_INIT],
{
if ! $gl_gnulib_enabled_dirfd; then
gl_FUNC_DIRFD
- if test $ac_cv_func_dirfd = no && test $gl_cv_func_dirfd_macro = no; then
+ if test $ac_cv_func_dirfd = no && test $gl_cv_func_dirfd_macro = no \
+ || test $REPLACE_DIRFD = 1; then
AC_LIBOBJ([dirfd])
gl_PREREQ_DIRFD
fi
diff --git a/m4/utimes.m4 b/m4/utimes.m4
index a016723e24..1876bec799 100644
--- a/m4/utimes.m4
+++ b/m4/utimes.m4
@@ -1,5 +1,5 @@
# Detect some bugs in glibc's implementation of utimes.
-# serial 3
+# serial 4
dnl Copyright (C) 2003-2005, 2009-2016 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
@@ -33,6 +33,7 @@ AC_DEFUN([gl_FUNC_UTIMES],
#include <stdlib.h>
#include <stdio.h>
#include <utime.h>
+#include <errno.h>
static int
inorder (time_t a, time_t b, time_t c)
@@ -45,7 +46,10 @@ main ()
{
int result = 0;
char const *file = "conftest.utimes";
- static struct timeval timeval[2] = {{9, 10}, {999999, 999999}};
+ /* On OS/2, file timestamps must be on or after 1980 in local time,
+ with an even number of seconds. */
+ static struct timeval timeval[2] = {{315620000 + 10, 10},
+ {315620000 + 1000000, 999998}};
/* Test whether utimes() essentially works. */
{
@@ -82,9 +86,19 @@ main ()
result |= 1;
else if (fstat (fd, &st0) != 0)
result |= 1;
- else if (utimes (file, timeval) != 0)
+ else if (utimes (file, timeval) != 0
+ && (errno != EACCES
+ /* OS/2 kLIBC utimes fails on opened files. */
+ || close (fd) != 0
+ || utimes (file, timeval) != 0
+ || (fd = open (file, O_WRONLY)) < 0))
result |= 2;
- else if (utimes (file, NULL) != 0)
+ else if (utimes (file, NULL) != 0
+ && (errno != EACCES
+ /* OS/2 kLIBC utimes fails on opened files. */
+ || close (fd) != 0
+ || utimes (file, NULL) != 0
+ || (fd = open (file, O_WRONLY)) < 0))
result |= 8;
else if (fstat (fd, &st1) != 0)
result |= 1;