The Samba-Bugzilla – Attachment 10673 Details for
Bug 11078
unsupported timestamp resolution in cifs vfs:mtime changes after fsync(); fclose();
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
Reproducer
fsync-mtime.c (text/x-csrc), 1.41 KB, created by
Jakob Unterwurzacher
on 2015-01-27 21:26:43 UTC
(
hide
)
Description:
Reproducer
Filename:
MIME Type:
Creator:
Jakob Unterwurzacher
Created:
2015-01-27 21:26:43 UTC
Size:
1.41 KB
patch
obsolete
>/* Test if the mtime changes after fsync() has been called > * > * Maintained at https://gist.github.com/rfjakob/24ef07667fb435f40b21 > * > * Bug originally reported at > * http://debbugs.gnu.org/cgi/bugreport.cgi?bug=19607 > * > * Compile with: > * gcc fsync-mtime.c -o fsync-mtime > */ > >#include <unistd.h> >#include <stdio.h> >#include <sys/stat.h> >#include <fcntl.h> > >int >main (void) >{ > char const *filename = "test.txt"; > int fd = open(filename, O_WRONLY|O_CREAT|O_TRUNC|O_CLOEXEC, 0666); > if (fd < 0) > return perror ("open"), 1; > static char const message[] = "This is a test.\n"; > int messagelen = sizeof message - 1; > if (write (fd, message, messagelen) != messagelen) > return perror ("write"), 1; > if (fsync (fd) != 0) > return perror ("fsync"), 1; > struct stat st1, st2; > if (fstat (fd, &st1) != 0) > return perror ("fstat"), 1; > if (close (fd) != 0) > return perror ("close"), 1; > sleep (2); > if (stat (filename, &st2) != 0) > return perror ("stat"), 1; > if (! (st1.st_mtim.tv_sec == st2.st_mtim.tv_sec > && st1.st_mtim.tv_nsec == st2.st_mtim.tv_nsec)) > { > printf ("stat #1: %ld.%09ld\n", st1.st_mtim.tv_sec, st1.st_mtim.tv_nsec); > printf ("stat #2: %ld.%09ld\n", st2.st_mtim.tv_sec, st2.st_mtim.tv_nsec); > printf ("last-modified times do not conform to:\n" > "http://pubs.opengroup.org/onlinepubs/" > "9699919799/basedefs/V1_chap04.html#tag_04_08\n"); > return 1; > } > return 0; >}
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 11078
: 10673