diff options
author | Niels de Vos <ndevos@redhat.com> | 2013-06-27 18:05:54 +0200 |
---|---|---|
committer | Vijay Bellur <vbellur@redhat.com> | 2013-07-10 01:58:11 -0700 |
commit | 72aef87eeddc59428af67f2e6a666839b0ddd09c (patch) | |
tree | 8eb7057e71c066c5ca0b5c0eba81476879a9cc9b /extras | |
parent | 63ed610617458ac4fd85cb83471df2222380f28a (diff) |
test-ffop: the result of (O_TRUNC|O_RDONLY) is unspecified
On RHEL-6 an open(.., O_TRUNC|O_RDONLY) fails. test-ffop expects this to
succeed, but the behaviour is unspecified according to 'man 2 open':
O_TRUNC
If the file already exists and is a regular file and the open
mode allows writing (i.e., is O_RDWR or O_WRONLY) it will be
truncated to length 0. If the file is a FIFO or terminal device
file, the O_TRUNC flag is ignored. Otherwise the effect of
O_TRUNC is unspecified.
Change-Id: I76b55419871fc758cbe82532f9b75476a0c14101
Signed-off-by: Niels de Vos <ndevos@redhat.com>
Reviewed-on: http://review.gluster.org/5268
Reviewed-by: Vijay Bellur <vbellur@redhat.com>
Tested-by: Vijay Bellur <vbellur@redhat.com>
Diffstat (limited to 'extras')
-rw-r--r-- | extras/test/test-ffop.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/extras/test/test-ffop.c b/extras/test/test-ffop.c index 6ce7097d5c5..2d174d45276 100644 --- a/extras/test/test-ffop.c +++ b/extras/test/test-ffop.c @@ -777,6 +777,7 @@ test_open_modes (char *filename) goto out; } +#if 0 /* undefined behaviour, unable to reliably test */ ret = creat (filename, 0644); close (ret); ret = generic_open_read_write (filename, O_TRUNC|O_RDONLY); @@ -784,6 +785,7 @@ test_open_modes (char *filename) fprintf (stderr, "flag O_TRUNC|O_RDONLY failed\n"); goto out; } +#endif ret = generic_open_read_write (filename, O_CREAT|O_RDWR|O_SYNC); if (0 != ret) { |