diff options
author | Paul Eggert <eggert@cs.ucla.edu> | 2016-01-24 14:50:47 -0800 |
---|---|---|
committer | Paul Eggert <eggert@cs.ucla.edu> | 2016-01-24 14:51:22 -0800 |
commit | 1698036a43d9e2c55ead6216ea7156df8615da47 (patch) | |
tree | 60bb61c907536ebc38c6b301fd754028b8a9b542 /m4/utimes.m4 | |
parent | fbce4757a874cc43806eb41b8637538b101c3c69 (diff) | |
download | emacs-1698036a43d9e2c55ead6216ea7156df8615da47.tar.gz |
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/utimes.m4')
-rw-r--r-- | m4/utimes.m4 | 22 |
1 files changed, 18 insertions, 4 deletions
diff --git a/m4/utimes.m4 b/m4/utimes.m4 index a016723e24a..1876bec7996 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; |