From: yuri AT cs DOT cracksoft DOT kiev DOT ua (Yuri Kuzmenko) Subject: b19.x trouble 16 Apr 1998 15:13:53 -0700 Message-ID: <199804161042.MAA13712.cygnus.gnu-win32@cs.cracksoft.kiev.ua> To: gnu-win32 AT cygnus DOT com I have a small trouble with stat() call in cygwin32 beta 19. Unfortunately, I don't test my programm on the older versions. Problem is stat() returns time (mtime) = original file mtime - 1 second. I have run cygwin on win95osr2, vfat. Then, if I call utime() with mtime which returned by stat(), as result I got time of file = original file time - 2 seconds. There is example: // please reply to me by mail because I don't connected to mailing list #ifndef O_BINARY #define O_BINARY 0 #endif #define CP_BUFSIZE (1024*128L) /* 128k blocks */ static int cp_(char *oldname,char *newname,int add) /* copy oldname to newname use mmap with maximal buffer size = CP_BUFSIZE >>> gnu_z: FUCKOFF, don't use mmap (?), use xmalloc mmap fails on big size files * xmalloc is malloc with auto-zero check */ { struct stat stbuf; int r,fd_in,fd_out; ssize_t write_return; char *data; struct utimbuf utbuf; unsigned long a,b,i; int read_res; if((r=stat(oldname,&stbuf))) return r; fd_in=open(oldname,O_RDONLY|O_BINARY); if(fd_in==-1) return -2; if(add==FALSE) fd_out=open(newname,O_BINARY|O_WRONLY|O_CREAT|O_TRUNC,stbuf.st_mode); else fd_out=open(newname,O_WRONLY|O_CREAT|O_APPEND|O_BINARY,stbuf.st_mode); if(fd_out==-1) { close(fd_in); return -3; } a=stbuf.st_size / CP_BUFSIZE; /* how many blocks */ b=stbuf.st_size % CP_BUFSIZE; /* last block size */ if(a) data=xmalloc(CP_BUFSIZE); for(i=0;i