summaryrefslogtreecommitdiff
path: root/lib/utimens.c
Commit message (Collapse)AuthorAgeFilesLines
* license: fix GPLv3 texts to use a comma instead of semicolon.Bernhard Voelker2022-01-051-1/+1
| | | | | | | | | See: https://www.gnu.org/licenses/gpl-3.0.html#howto Run: $ git grep -l 'Foundation; either version 3' \ | xargs sed -i '/Foundation; either version 3/ s/n; e/n, e/' * All files using GPLv3: Adjust via the above command.
* maint: run 'make update-copyright'Paul Eggert2022-01-011-1/+1
|
* Put LGPLv3+ notices in source files where appropriate.Bruno Haible2021-06-041-7/+7
| | | | | * lib/**.{h,c}: Use LGPLv3+ notice whenever the module description says so.
* utimens: fix confusing arg type in internal funcPaul Eggert2021-04-071-3/+3
| | | | | | | | | | | | | | | Although the old code was technically correct, this was accidental and it understandably confused Coverity. Reported by Ondrej Dubaj in: https://lists.gnu.org/r/bug-tar/2021-04/msg00000.html * lib/utimens.c (update_timespec): Change arg type from ‘struct timespec *[2]’ (pointer to array of 2 pointers to timespecs) to ‘struct timespec **’ (pointer to pointer to the first timespec in an array of 2 timespecs). Although the old code happened to be technically correct, it was misleading and confused Coverity. And though the type ‘struct timespec (**)[2]’ (pointer to pointer to array of 2 timespecs) would perhaps be more technically correct, it would be almost as confusing and would require changes elsewhere in this file; let’s quit while we’re ahead.
* utimensat: Work around trailing slash bug in utimensat() on AIX 7.2.Bruno Haible2021-01-061-1/+3
| | | | | | | | | | | * m4/utimensat.m4 (gl_FUNC_UTIMENSAT): Require AC_CANONICAL_HOST. Add a test for trailing slash handling. Improve cross-compilation guesses. Conditionally define HAVE_NEARLY_WORKING_UTIMENSAT. * lib/utimensat.c (rpl_utimensat): Add alternative implementation when HAVE_NEARLY_WORKING_UTIMENSAT is defined. * lib/utimens.c: Use the overridden utimensat when HAVE_NEARLY_WORKING_UTIMENSAT is defined. * doc/posix-functions/utimensat.texi: Mention the AIX bug.
* utimens: Fix test failure on macOS 10.13.Bruno Haible2021-01-021-0/+1
| | | | * lib/utimens.c: Include <string.h>.
* utimens: Fix test failure on macOS 10.13.Bruno Haible2021-01-021-0/+14
| | | | | * lib/utimens.c (fdutimens): Before calling utimensat, recognize a filename ending in a slash that does not point to a directory.
* maint: run 'make update-copyright'Paul Eggert2020-12-311-1/+1
|
* maint: Run 'make update-copyright'Paul Eggert2019-12-311-1/+1
|
* all: Update URLs to msdn.microsoft.com.Bruno Haible2019-03-141-4/+4
| | | | | * lib/stat-w32.c et al.: Update URLs after most of msdn.microsoft.com was moved to docs.microsoft.com.
* maint: Run 'make update-copyright'Paul Eggert2019-01-011-1/+1
|
* timespec: fix resolution confusionPaul Eggert2018-09-101-2/+2
| | | | | | | | | | | In normal usage, clock resolution is given in seconds, but the code was mistakenly using inverse seconds and calling it “resolution”. Fix this, partly by renaming two identifiers. The old names will be kept for a bit, to ease transition. * lib/timespec.h (TIMESPEC_HZ, LOG10_TIMESPEC_HZ): New constants, replacing TIMESPEC_RESOLUTION and LOG10_TIMESPEC_RESOLUTION, which are now obsolescent. All uses changed.
* Simplify code. Drop support for Borland C++ on Windows.Bruno Haible2018-05-031-2/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Reported by Gisle Vanem <gisle.vanem@gmail.com>. * lib/accept4.c: Simplify 'defined _WIN32 || defined __WIN32__' to just 'defined _WIN32'. * lib/canonicalize-lgpl.c: Likewise. * lib/classpath.c: Likewise. * lib/clean-temp.c: Likewise. * lib/csharpexec.c: Likewise. * lib/ctime.c: Likewise. * lib/dosname.h: Likewise. * lib/dup2.c: Likewise. * lib/errno.in.h: Likewise. * lib/error.c: Likewise. * lib/euidaccess.c: Likewise. * lib/execute.c: Likewise. * lib/fcntl.in.h: Likewise. * lib/fcntl.c: Likewise. * lib/filename.h: Likewise. * lib/findprog.c: Likewise. * lib/flock.c: Likewise. * lib/fopen.c: Likewise. * lib/freopen.c: Likewise. * lib/fstat.c: Likewise. * lib/fsync.c: Likewise. * lib/gc-gnulib.c: Likewise. * lib/get-rusage-data.c: Likewise. * lib/getaddrinfo.c: Likewise. * lib/getdelim.c: Likewise. * lib/getdtablesize.c: Likewise. * lib/gethostname.c: Likewise. * lib/getlogin.c: Likewise. * lib/getlogin_r.c: Likewise. * lib/getopt.c: Likewise. * lib/getpagesize.c: Likewise. * lib/getpass.c: Likewise. * lib/getrusage.c: Likewise. * lib/gettimeofday.c: Likewise. * lib/glob.c: Likewise. * lib/inttypes.in.h: Likewise. * lib/isapipe.c: Likewise. * lib/javaexec.c: Likewise. * lib/link.c: Likewise. * lib/localcharset.c: Likewise. * lib/localename.h: Likewise. * lib/localename.c: Likewise. * lib/localtime.c: Likewise. * lib/lseek.c: Likewise. * lib/mbsinit.c: Likewise. * lib/mkdir.c: Likewise. * lib/msvc-nothrow.h: Likewise. * lib/nanosleep.c: Likewise. * lib/nl_langinfo.c: Likewise. * lib/nonblocking.c: Likewise. * lib/nproc.c: Likewise. * lib/open.c: Likewise. * lib/openpty.c: Likewise. * lib/pathmax.h: Likewise. * lib/pipe-filter-aux.c: Likewise. * lib/pipe-filter-gi.c: Likewise. * lib/pipe-filter-ii.c: Likewise. * lib/pipe.c: Likewise. * lib/pipe2.c: Likewise. * lib/poll.c: Likewise. * lib/popen.c: Likewise. * lib/posix_openpt.c: Likewise. * lib/printf-parse.c: Likewise. * lib/progreloc.c: Likewise. * lib/putenv.c: Likewise. * lib/read.c: Likewise. * lib/relocatable.c: Likewise. * lib/rename.c: Likewise. * lib/same-inode.h: Likewise. * lib/secure_getenv.c: Likewise. * lib/select.c: Likewise. * lib/sethostname.c: Likewise. * lib/setlocale.c: Likewise. * lib/sigaction.c: Likewise. * lib/sigprocmask.c: Likewise. * lib/sleep.c: Likewise. * lib/spawn-pipe.h: Likewise. * lib/spawn-pipe.c: Likewise. * lib/spawni.c: Likewise. * lib/stat-time.h: Likewise. * lib/stat-w32.c: Likewise. * lib/stat.c: Likewise. * lib/stdio.in.h: Likewise. * lib/stdio-impl.h: Likewise. * lib/stdio-read.c: Likewise. * lib/stdio-write.c: Likewise. * lib/stdlib.in.h: Likewise. * lib/strerror_r.c: Likewise. * lib/strftime-fixes.c: Likewise. * lib/sys_stat.in.h: Likewise. * lib/sys_types.in.h: Likewise. * lib/sys_wait.in.h : Likewise. * lib/system-quote.h: Likewise. * lib/system-quote.c: Likewise. * lib/tmpdir.c: Likewise. * lib/tzset.c: Likewise. * lib/uname.c: Likewise. * lib/unistd.in.h: Likewise. * lib/utime.in.h: Likewise. * lib/utime.c: Likewise. * lib/utimecmp.c: Likewise. * lib/utimens.c: Likewise. * lib/vasnprintf.c: Likewise. * lib/vma-iter.h: Likewise. * lib/vma-iter.c: Likewise. * lib/wait-process.c: Likewise. * lib/wcsftime.c: Likewise. * lib/wctype.in.h: Likewise. * lib/write.c: Likewise. * tests/nap.h: Likewise. * tests/test-cloexec.c: Likewise. * tests/test-dup-safer.c: Likewise. * tests/test-dup2.c: Likewise. * tests/test-dup3.c: Likewise. * tests/test-fcntl.c: Likewise. * tests/test-get-rusage-data.c: Likewise. * tests/test-getaddrinfo.c: Likewise. * tests/test-getlogin.h: Likewise. * tests/test-isatty.c: Likewise. * tests/test-localename.c: Likewise. * tests/test-mbrtowc-w32.c: Likewise. * tests/test-nonblocking.c: Likewise. * tests/test-nonblocking-pipe-main.c: Likewise. * tests/test-nonblocking-socket-main.c: Likewise. * tests/test-nonblocking-socket.h: Likewise. * tests/test-pipe.c: Likewise. * tests/test-pipe2.c: Likewise. * tests/test-poll.c: Likewise. * tests/test-pthread_sigmask1.c: Likewise. * tests/test-select.h: Likewise. * tests/test-sethostname2.c: Likewise. * tests/test-sigprocmask.c: Likewise. * tests/test-spawn-pipe-child.c: Likewise. * tests/test-stat-time.c: Likewise. * tests/test-system-quote-main.c: Likewise. * tests/test-utimens-common.h: Likewise. * tests/test-wcrtomb-w32.c: Likewise. * m4/csharpexec.m4 (gt_CSHARPEXEC): Likewise. * m4/getcwd.m4 (gl_FUNC_GETCWD_NULL): Likewise. * m4/javacomp.m4 (gt_JAVACOMP): Likewise. * m4/javaexec.m4 (gt_JAVAEXEC): Likewise. * m4/locale-ar.m4 (gt_LOCALE_AR): Likewise. * m4/locale-fr.m4 (gt_LOCALE_FR, gt_LOCALE_FR_UTF8): Likewise. * m4/locale-ja.m4 (gt_LOCALE_JA): Likewise. * m4/locale-tr.m4 (gt_LOCALE_TR_UTF8): Likewise. * m4/locale-zh.m4 (gt_LOCALE_ZH_CN): Likewise. * m4/malloc.m4 (gl_CHECK_MALLOC_POSIX): Likewise. * m4/nocrash.m4 (GL_NOCRASH): Likewise. * m4/pathmax.m4 (gl_PATHMAX_SNIPPET): Likewise. * m4/ptsname_r.m4 (gl_PREREQ_PTSNAME_R): Likewise. * m4/stdio_h.m4 (gl_STDIO_H): Likewise. * m4/tmpfile.m4 (gl_FUNC_TMPFILE): Likewise. * m4/unistd_h.m4 (gl_UNISTD_H): Likewise.
* maint: Run 'make update-copyright'Paul Eggert2018-01-011-1/+1
|
* all: Replace many more http URLs by https URLs. Update stale URLs.Bruno Haible2017-09-141-5/+5
| | | | | * users.txt: Remove mention of 'newts'. * lib/localename.c: Update comment about LANG_SOTHO.
* all: prefer https: URLsPaul Eggert2017-09-131-1/+1
|
* Implement a way to opt out from MSVC support.Bruno Haible2017-05-101-1/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is useful for Emacs. * modules/msvc-nothrow (configure.ac): Invoke gl_MODULE_INDICATOR. * lib/accept4.c: Include <io.h> as an alternative to msvc-nothrow.h. * lib/error.c: Likewise. * lib/fcntl.c: Likewise. * lib/flock.c: Likewise. * lib/fstat.c: Likewise. * lib/fsync.c: Likewise. * lib/ioctl.c: Likewise. * lib/isapipe.c: Likewise. * lib/lseek.c: Likewise. * lib/nonblocking.c: Likewise. * lib/poll.c: Likewise. * lib/select.c: Likewise. * lib/sockets.h: Likewise. * lib/sockets.c: Likewise. * lib/stdio-read.c: Likewise. * lib/stdio-write.c: Likewise. * lib/utimens.c: Likewise. * lib/w32sock.h: Likewise. * lib/w32spawn.h: Likewise. * tests/test-cloexec.c: Likewise. * tests/test-dup-safer.c: Likewise. * tests/test-dup2.c: Likewise. * tests/test-dup3.c: Likewise. * tests/test-fcntl.c: Likewise. * tests/test-pipe.c: Likewise. * tests/test-pipe2.c: Likewise. * lib/ftruncate.c: Likewise. (chsize_nothrow): Renamed from chsize. * lib/msvc-nothrow.c: Don't include msvc-inval.h if HAVE_MSVC_INVALID_PARAMETER_HANDLER is not defined. * lib/close.c: Likewise. * lib/dup.c: Likewise. * lib/fclose.c: Likewise. * lib/raise.c: Likewise. * tests/test-fgetc.c: Likewise. * tests/test-fputc.c: Likewise. * tests/test-fread.c: Likewise. * tests/test-fwrite.c: Likewise. * lib/getdtablesize.c: Likewise. (_setmaxstdio_nothrow): Renamed from _setmaxstdio. * lib/isatty.c: Don't include msvc-inval.h if HAVE_MSVC_INVALID_PARAMETER_HANDLER is not defined. Include <io.h> as an alternative to msvc-nothrow.h. * lib/read.c: Likewise. * lib/write.c: Likewise. * lib/dup2.c: Likewise. (dup2_nothrow): New function. (ms_windows_dup2): Use it. * m4/close.m4 (gl_FUNC_CLOSE): Invoke gl_MSVC_INVAL and test HAVE_MSVC_INVALID_PARAMETER_HANDLER only if gl_MSVC_INVAL is defined. * m4/dup.m4 (gl_FUNC_DUP): Likewise. * m4/fdopen.m4 (gl_FUNC_FDOPEN): Likewise. * m4/raise.m4 (gl_FUNC_RAISE): Likewise. * m4/read.m4 (gl_FUNC_READ): Likewise. * m4/write.m4 (gl_FUNC_WRITE): Likewise. * doc/windows-without-msvc.texi: New file. * doc/gnulib.texi (Native Windows Support without MSVC Support): New section.
* utimens: On native Windows, support 100ns resolution also if fd < 0.Bruno Haible2017-05-081-1/+3
| | | | | | | | | | * lib/utime.in.h: Include <time.h>. (_gl_utimens_windows): New declaration. * lib/utime.c (_gl_utimens_windows): New function, based on utime. (utime): Invoke it. * lib/utimens.c (fdutimens): On native Windows, call _gl_utimens_windows instead of utime. * modules/utime (Depends-on): Add 'time'.
* utimens: Improve error code on native Windows.Bruno Haible2017-05-081-3/+11
| | | | | * lib/utimens.c (fdutimens): If fd was not opened with O_RDWR, fail with error code EACCES, not EINVAL.
* utimens: port to Emacs + MS-WindowsPaul Eggert2017-05-021-2/+8
| | | | | | | | Skip the new MS-Windows-specific code if Emacs. * lib/utimens.c [EMACS_CONFIGUATION]: Avoid new MS-Windows-specific code. (USE_SETFILETIME): New macro. (fdutimens): Use it.
* utimens: Add support for native Windows.Bruno Haible2017-05-011-0/+82
| | | | | | | | * lib/utimens.c: Include <windows.h>, msvc-nothrow.h. (fdutimens): Provide a native Windows implementation, like utime.c with added tv_nsec support. * modules/utimens (Depends-on): Add msvc-nothrow, utime. Suggested by Tim Rühsen <tim.ruehsen@gmx.de>.
* utime-h: Modernize handling of 'struct utimbuf'.Bruno Haible2017-04-301-10/+0
| | | | | | | | | | | | | | | | | * lib/utime.in.h: Include next <utime.h> if it exists. (utimbuf): Define to _utimbuf on native Windows. * m4/utime-h.m4 (gl_UTIME_H): Check for prerequisites of include_next. Set UTIME_H on native Windows. (gl_UTIME_MODULE_INDICATOR, gl_HEADER_UTIME_H_DEFAULTS): New macros. * modules/utime-h (Depends-on): Add include_next. (Makefile.am): Substitute also HAVE_UTIME_H, INCLUDE_NEXT, PRAGMA_SYSTEM_HEADER, PRAGMA_COLUMNS, NEXT_UTIME_H. * lib/utimens.c (utimbuf): Remove fallback definition. * m4/utimens.m4 (gl_UTIMENS): Don't require gl_CHECK_TYPE_STRUCT_UTIMBUF. * m4/utimbuf.m4: Remove file. * modules/utimens (Files): Remove m4/utimbuf.m4.
* Make use of module 'utime-h'.Bruno Haible2017-04-301-4/+1
| | | | | | | | | * modules/copy-file (Depends-on): Add utime-h. * lib/copy-file.c: Assume that <utime.h> exists. * m4/copy-file.m4 (gl_COPY_FILE): Don't test for <utime.h>. * modules/utimens (Depends-on): Add utime-h. * lib/utimens.c: Assume that <utime.h> exists.
* maint: time stamp -> timestampPaul Eggert2017-01-091-5/+5
| | | | Use the spelling "timestamp", as that is what POSIX uses.
* version-etc: new yearPaul Eggert2017-01-011-1/+1
| | | | | | | | | | * build-aux/gendocs.sh (version): * doc/gendocs_template: * doc/gendocs_template_min: * doc/gnulib.texi: * lib/version-etc.c (COPYRIGHT_YEAR): Update copyright dates by hand in templates and the like. * all files: Run 'make update-copyright'.
* version-etc: new yearPaul Eggert2016-01-011-1/+1
| | | | | | | | | | * build-aux/gendocs.sh (version): * doc/gendocs_template: * doc/gendocs_template_min: * doc/gnulib.texi: * lib/version-etc.c (COPYRIGHT_YEAR): Update copyright dates by hand in templates and the like. * all files: Run 'make update-copyright'.
* version-etc: new yearPaul Eggert2014-12-311-1/+1
| | | | | | * doc/gnulib.texi: * lib/version-etc.c (COPYRIGHT_YEAR): Update copyright date. * all files: Run 'make update-copyright'.
* assure: new modulePaul Eggert2014-12-201-2/+0
| | | | | | | | | | | | | | | This works better than 'assert' when compiling with -DNDEBUG, as it avoids some compiler diagnostics in that case. Reported by Norihiro Tanaka in: http://lists.gnu.org/archive/html/bug-gnulib/2014-12/msg00215.html * MODULES.html.sh (func_all_modules): Add 'assure'. * lib/assure.h, modules/assure: New files. * lib/chdir-long.c, lib/cycle-check.c, lib/fchdir.c, lib/fts.c: * lib/poll.c, lib/savewd.c, lib/utimens.c, lib/xstrtol.c: Prefer 'assure' to 'assert'. * modules/chdir-long, modules/cycle-check, modules/fchdir: * modules/poll, modules/savewd, modules/utimens, modules/xstrtol: Depend on 'assure'.
* maint: update copyrightEric Blake2014-01-011-1/+1
| | | | | | I ran 'make update-copyright'. Signed-off-by: Eric Blake <eblake@redhat.com>
* timespec: new function make_timespec, and new constantsPaul Eggert2013-09-191-2/+4
| | | | | | | | | | | | * lib/timespec.h: Incorporate recent changes on the Emacs trunk. (TIMESPEC_RESOLUTION, LOG10_TIMESPEC_RESOLUTION): New constants. (make_timespec): New function. * lib/dtotimespec.c (dtotimespec): * lib/timespec-add.c (timespec_add): * lib/timespec-sub.c (timespec_sub): * lib/utimens.c (validate_timespec): * lib/utimensat.c (rpl_utimensat): Use these new constants and functions.
* utimens, utimensat: work around Solaris UTIME_OMIT bugPaul Eggert2013-04-301-8/+16
| | | | | | | | | Solaris 11.1 and Solaris 10 have the same UTIME_OMIT bug that Linux kernel 2.6.32 does. Work around it in the same way. * doc/posix-functions/futimens.texi (futimens): * doc/posix-functions/utimensat.texi (utimensat): Document the bug. * lib/utimens.c (fdutimens, lutimens): * lib/utimensat.c (rpl_utimensat): Work around the bug.
* maint: update all copyright year number rangesEric Blake2013-01-011-1/+1
| | | | | | Run "make update-copyright". Compare to commit 1602f0a from last year. Signed-off-by: Eric Blake <eblake@redhat.com>
* utimens: use extern-inlinePaul Eggert2012-08-011-0/+1
| | | | | | | | * lib/utimens.c (_GL_UTIMENS_INLINE): Define when including utimens.h. * lib/utimens.h: Add copyright notice, since this is now large enough to copyright. Use _GL_INLINE_HEADER_BEGIN, _GL_INLINE_HEADER_END. (_GL_UTIMENS_INLINE): New macro. Use it instead of 'static inline'. * modules/utimens (Depends-on): Add extern-inline.
* maint: update all copyright year number rangesJim Meyering2012-01-011-1/+1
| | | | Run "make update-copyright".
* utimens: remove dependency on dup2Paul Eggert2011-09-181-9/+4
| | | | | | * lib/utimens.c (fdutimens): Don't invoke dup2; it's not needed to work around the Linux kernel bug. * modules/utimens (Depends-on): Remove dup2.
* maint: update almost all copyright ranges to include 2011Jim Meyering2011-01-011-1/+1
| | | | Run the new "make update-copyright" rule.
* utimens: work around glibc rounding bug on more platformsPaul Eggert2010-12-271-1/+1
| | | | | | * lib/utimens.c (fdutimens): Work around rounding bug even if HAVE_WORKING_UTIMES. Reported for Linux 2.4.21 by Bruno Haible in <http://lists.gnu.org/archive/html/bug-gnulib/2010-12/msg00298.html>.
* utimens: work around glibc rounding bug on older Linux kernelsPaul Eggert2010-12-271-5/+46
| | | | | | | | * lib/utimens.c (fdutimens): If invoking futimesat or futimes on Linux with a glibc whose utimes might not work, then work around a longstanding glibc bug involving rounding rather than truncated time stamps. Reported for Linux 2.4.21 by Bruno Haible in <http://lists.gnu.org/archive/html/bug-gnulib/2010-11/msg00113.html>.
* fdutimens, fdutimensat: update signature, againEric Blake2010-09-171-20/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | In general, merging: f<act>(fd,args) and <act>at(dir,name,args) should produce: fd<act>at(fd,dir,name,args) * lib/utimens.h (gl_futimens): Delete, and move signature... (fdutimens): ...here. (fdutimensat): Rearrange signature. (lutimensat): Rename variable for clarity. * lib/fdutimensat.c (fdutimensat): Update signature. * lib/utimens.c (fdutimens): Likewise. (gl_futimens): Delete. (utimens, lutimens): Update callers. * lib/futimens.c (futimens): Likewise. * tests/test-fdutimensat.c: Likewise. * tests/test-utimens.c: Likewise. * tests/test-futimens.h: Update comment. * NEWS: Mention this. Suggested by Paul Eggert. Signed-off-by: Eric Blake <eblake@redhat.com>
* utimens: avoid compiler warningAndreas Gruenbacher2010-04-281-2/+2
| | | | | | | | * lib/utimens.c: On Tru64, the timestamp parameter of utimens(2) is not declared as a const *; avoid warnings in that case. Signed-off-by: Andreas Gruenbacher <agruen@suse.de> Signed-off-by: Eric Blake <eblake@redhat.com>
* utimens (fdutimens): ignore a negative FD, per contractAurelien Jarno2010-01-051-11/+12
| | | | | | | | | | | * lib/utimens.c (fdutimens) [HAVE_FUTIMENS]: Call futimens only when we have a valid file descriptor. Otherwise, using a brand new glibc (with just-patched futimens that now fails with EBADF) would cause this function to fail with ENOSYS. Reported by Guillaume Ayoub in http://bugs.debian.org/563726. See also http://bugzilla.redhat.com/552320. Signed-off-by: Eric Blake <ebb9@byu.net>
* update nearly all FSF copyright year lists to include 2010Jim Meyering2010-01-011-1/+1
| | | | | Use the same procedure as for 2009, outlined in http://thread.gmane.org/gmane.comp.lib.gnulib.bugs/20081
* utimens: avoid shadowing warningEric Blake2009-12-311-5/+8
| | | | | | | | | | | | | | | lutimens declared struct stat st in two scopes. Worse, on Linux kernels between 2.6.18 and 2.6.22 (when utimensat existed, but rejected AT_SYMLINK_NOFOLLOW) or before 2.6.18 (if the glibc headers have utimensat, but the kernel does not), it would result in redundant [fl]stat calls. * lib/utimens.c (fdutimens, lutimens): Consolidate separate stat buffers into one, to avoid shadowing, as well as avoiding a redundant stat. Reported by Jim Meyering. Signed-off-by: Eric Blake <ebb9@byu.net>
* futimens, utimensat: work around ntfs-3g bugEric Blake2009-12-301-101/+44
| | | | | | | | | | | | | | | | | | | | | | | | | | With ntfs-3g, use of a single UTIME_OMIT failed to make any change to the remaining two timestamps. Furthermore, the previous fix for ctime happens to be specific to xfs, rather than global to the kernel. Therefore, to be valid, a cache would have to be per-device, which gets too expensive, especially considering that the cost of a preparatory stat pulls the file into kernel cache to speed up the resulting utimensat. So, blindly massage UTIME_OMIT on Linux, even on working filesystems like ext4. The bugs in xfs and ntfs-3g were reported to the kernel folks, and fixes written, but it will be several years before gnulib can assume that file systems in use have picked up the fixes. * lib/utimensat.c (rpl_utimensat): Drop attempts to cache whether a ctime bug is present, and expand workaround to cover ntfs-3g. * lib/utimens.c (fdutimens, lutimens): Likewise. (utimensat_ctime_really, detect_ctime_bug): Drop cache mechanism. (validate_timespec): Adjust return value. * m4/futimens.m4 (gl_FUNC_FUTIMENS): Update comment. * m4/utimensat.m4 (gl_FUNC_UTIMENSAT): Likewise. Reported by ctrn3e8 <ctrn3e8@gmail.com>. Signed-off-by: Eric Blake <ebb9@byu.net>
* update nearly all FSF copyright year lists to include 2009Jim Meyering2009-12-291-2/+1
| | | | | | | | | | | | | | | | | | The files named by the following are exempted: grep -v '^#' config/srclist.txt|grep -v '^$' \ | while read src dst; do test -f "$dst" && { echo "$dst"; continue; } test -d "$dst" || continue echo "$dst"/$(basename "$src") done > exempt git ls-files tests/unictype >> exempt In the remaining files, convert to all-interval notation if - there is already at least one year interval like 2000-2003 - the file is maintained by me - the file is in lib/uni*/, where that style already prevails Otherwise, use update-copyright's default.
* utimens: work around Linux ctime bugEric Blake2009-12-191-20/+133
| | | | | | | | | | | | | | Force a ctime update by using stat() before any utimensat call with mtime of UTIME_OMIT. But avoid extra stat()s in later calls, by doing extra work on the first instance in order to cache whether the bug is actually present. * lib/utimens.c (detect_ctime_bug): New helper function. (update_timespec): Differentiate between workaround needed for this bug vs. what is needed for systems that lack utimensat. (fdutimens, lutimens): Work around bug. Signed-off-by: Eric Blake <ebb9@byu.net>
* utimens: one more try at avoiding compiler warningEric Blake2009-12-141-2/+2
| | | | | | * lib/utimens.c (lutimens): Lower scope of result. Signed-off-by: Eric Blake <ebb9@byu.net>
* utimens: fix compilation errorEric Blake2009-11-301-1/+2
| | | | | | | | | Fixes a regression from 2009-11-25. * lib/utimens.c (lutimens) [!HAVE_UTIMENSAT && HAVE_LUTIMES]: Declare variable at right scope. Signed-off-by: Eric Blake <ebb9@byu.net>
* utimens: work around older Linux failure with symlinksEric Blake2009-11-251-8/+16
| | | | | | | | | | | | | | | Some Linux kernel versions support utimensat(,0) but not utimensat(,AT_SYMLINK_NOFOLLOW), even for non-symlinks. Had the fallback code for regular files been reached, it would have truncated timestamps. But since glibc lutimes just wraps utimensat, and we didn't expect ENOSYS from lutimes, the fallback wasn't even reached. * lib/utimens.c (lutimensat_works_really): New variable. (fdutimens, lutimens): Use it to manage kernels that support nanosecond times on files, but not on symlinks. Reported by Ondřej Vašík. Signed-off-by: Eric Blake <ebb9@byu.net>
* utimens: fix regression on SolarisEric Blake2009-11-181-5/+9
| | | | | | | | | | | | | | | Revert commit 26c5fd742f. Solaris lacks futimens and futimes, so futimesat is the only way to change fd timestamps. But since FreeBSD futimesat can't change fd timestamps, we need a configure check to avoid the crash there. * m4/utimens.m4 (gl_UTIMENS): Check for BSD bug. * lib/utimens.c (fdutimens): Revert 2009-11-08 change; Solaris 10 can only change fd timestamps via futimesat. Instead, use an additional witness macro to avoid BSD bug. Reported by Jim Meyering. Signed-off-by: Eric Blake <ebb9@byu.net>