[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v3 12/13] utimes: detect utimes() correctly on OS/2 kLIBC
From: |
KO Myung-Hun |
Subject: |
[PATCH v3 12/13] utimes: detect utimes() correctly on OS/2 kLIBC |
Date: |
Mon, 19 Jan 2015 13:47:18 +0900 |
utimes() of OS/2 kLIBC has some limitations.
1. OS/2 itself supports a file date since 1980 year in local time.
2. OS/2 itself supports even seconds for a file time.
3. utimes() of OS/2 kLIBC does not work on an opened file.
* m4/utimes.m4: Detect utimes() correctly on OS/2 kLIBC.
---
m4/utimes.m4 | 14 +++++++++++---
1 file changed, 11 insertions(+), 3 deletions(-)
diff --git a/m4/utimes.m4 b/m4/utimes.m4
index e26a576..a6f00c1 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-2015 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
@@ -45,7 +45,10 @@ main ()
{
int result = 0;
char const *file = "conftest.utimes";
- static struct timeval timeval[2] = {{9, 10}, {999999, 999999}};
+ /* On OS/2, a file date should be since 1980 year in local time
+ and even seconds. */
+ static struct timeval timeval[2] = {{315620000 + 10, 10},
+ {315620000 + 1000000, 999998}};
/* Test whether utimes() essentially works. */
{
@@ -82,11 +85,16 @@ main ()
result |= 1;
else if (fstat (fd, &st0) != 0)
result |= 1;
+ /* utimes() of OS/2 kLIBC does not work on an opened file */
+ else if (close (fd) != 0)
+ result |= 1;
else if (utimes (file, timeval) != 0)
result |= 2;
else if (utimes (file, NULL) != 0)
result |= 8;
- else if (fstat (fd, &st1) != 0)
+ else if (lstat (file, &st1) != 0)
+ result |= 1;
+ else if ((fd = open (file, O_WRONLY)) < 0)
result |= 1;
else if (write (fd, "\n", 1) != 1)
result |= 1;
--
1.8.5.2
- [PATCH v3 06/13] wcwidth: fix 'conflicting types' error for `__wcwidth' on OS/2 kLIBC, (continued)
- [PATCH v3 06/13] wcwidth: fix 'conflicting types' error for `__wcwidth' on OS/2 kLIBC, KO Myung-Hun, 2015/01/18
- [PATCH v3 02/13] binary-io: don't put fd in binary mode if it is a console on EMX, KO Myung-Hun, 2015/01/18
- [PATCH v3 01/13] stdint: check _INTPTR_T_DECLARED before defining intptr_t and uintptr_t, KO Myung-Hun, 2015/01/18
- [PATCH v3 03/13] pipe-filter-aux: undefine HAVE_SELECT on KLIBC, KO Myung-Hun, 2015/01/18
- [PATCH v3 04/13] w32spawn: clear SHELL_SPECIAL_CHARS and SHELL_SPACE_CHAR on OS/2 kLIBC, KO Myung-Hun, 2015/01/18
- [PATCH v3 08/13] pipe_filter_ii_execute: port to OS/2 kLIBC, KO Myung-Hun, 2015/01/18
- [PATCH v3 07/13] gnulib-tool: fall back into copy if symbolic link is not supported, KO Myung-Hun, 2015/01/18
- [PATCH v3 09/13] dup, dup2, fcntl: support a directory fd on OS/2 kLIBC, KO Myung-Hun, 2015/01/18
- [PATCH v3 11/13] configmake: prepend /@unixroot on OS/2 kLIBC, KO Myung-Hun, 2015/01/18
- [PATCH v3 13/13] openat_proc_name: port to OS/2 kLIBC, KO Myung-Hun, 2015/01/18
- [PATCH v3 12/13] utimes: detect utimes() correctly on OS/2 kLIBC,
KO Myung-Hun <=
- [PATCH v3 10/13] opendir, closedir, dirfd, fdopendir: port to OS/2 kLIBC, KO Myung-Hun, 2015/01/18