This is the mail archive of the libc-hacker@sources.redhat.com mailing list for the glibc project.
Note that libc-hacker is a closed list. You may look at the archives of this list, but subscription and posting are not open.
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
Other format: | [Raw text] |
On Thu, Jul 31, 2003 at 11:43:06PM +1000, Greg Schafer wrote: > Thanks, that fixed it. > > There is similar code in sysdeps/unix/sysv/linux/futimes.c and > sysdeps/posix/utimes.c that may also be affected. futimes.c seems to be indeed broken the same way (sorry, missed it). But sysdeps/posix/utimes.c is not: times->actime = tvp[0].tv_sec + tvp[0].tv_usec / 1000000; times->modtime = tvp[1].tv_sec + tvp[1].tv_usec / 1000000; The question is what is utimes/futimes supposed to do if tv_usec > 999999. I couldn't find anything in POSIX about it, so I don't know which one of: tvp[0].tv_sec + (tvp[0].tv_usec >= 500000) tvp[0].tv_sec + tvp[0].tv_usec / 1000000 tvp[0].tv_sec + (tvp[0].tv_usec + 500000) / 1000000 is needed (but then, it should probably used everywhere, not one way in some *utimes.c implementations and differently in others. 2003-07-31 Jakub Jelinek <jakub@redhat.com> * sysdeps/unix/sysv/linux/futimes.c (__utimes): Add parens so that actime and modtime are computed properly. --- libc/sysdeps/unix/sysv/linux/futimes.c.jj 2003-07-16 06:10:01.000000000 -0400 +++ libc/sysdeps/unix/sysv/linux/futimes.c 2003-07-31 09:54:53.000000000 -0400 @@ -1,4 +1,4 @@ -/* futimes -- change access and modification times of open file. Stub version. +/* futimes -- change access and modification times of open file. Linux version. Copyright (C) 2002, 2003 Free Software Foundation, Inc. This file is part of the GNU C Library. @@ -58,8 +58,8 @@ __futimes (int fd, const struct timeval if (tvp != NULL) { times = &buf; - buf.actime = tvp[0].tv_sec + tvp[0].tv_usec >= 500000; - buf.modtime = tvp[1].tv_sec + tvp[1].tv_usec >= 500000; + buf.actime = tvp[0].tv_sec + (tvp[0].tv_usec >= 500000); + buf.modtime = tvp[1].tv_sec + (tvp[1].tv_usec >= 500000); } else times = NULL; Jakub
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |