| delorie.com/archives/browse.cgi | search |
| X-Recipient: | archive-cygwin AT delorie DOT com |
| X-SWARE-Spam-Status: | No, hits=-7.1 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_HI,RP_MATCHES_RCVD,SPF_HELO_PASS,TW_FD |
| X-Spam-Check-By: | sourceware.org |
| Message-ID: | <4E7A4C69.5080807@redhat.com> |
| Date: | Wed, 21 Sep 2011 14:43:21 -0600 |
| From: | Eric Blake <eblake AT redhat DOT com> |
| User-Agent: | Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.22) Gecko/20110906 Fedora/3.1.14-1.fc14 Lightning/1.0b3pre Mnenhy/0.8.3 Thunderbird/3.1.14 |
| MIME-Version: | 1.0 |
| To: | cygwin <cygwin AT cygwin DOT com> |
| Subject: | fsync bug |
| X-IsSubscribed: | yes |
| Mailing-List: | contact cygwin-help AT cygwin DOT com; run by ezmlm |
| List-Id: | <cygwin.cygwin.com> |
| List-Subscribe: | <mailto:cygwin-subscribe AT cygwin DOT com> |
| List-Archive: | <http://sourceware.org/ml/cygwin/> |
| List-Post: | <mailto:cygwin AT cygwin DOT com> |
| List-Help: | <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs> |
| Sender: | cygwin-owner AT cygwin DOT com |
| Mail-Followup-To: | cygwin AT cygwin DOT com |
| Delivered-To: | mailing list cygwin AT cygwin DOT com |
fsync() is required to work on read-only fds (in theory, you can sync
the atime metadata, which is a write operation triggered by a read-only
fd). But cygwin rejects this program, which works on Linux:
$ cat foo.c
#include <errno.h>
#include <unistd.h>
#include <stdio.h>
#include <stdlib.h>
#include <assert.h>
#include <fcntl.h>
int main (void)
{
int fd = open("file", O_CREAT|O_EXCL|O_WRONLY, 0600);
if (fd < 0)
return 1;
if (close(fd))
return 2;
fd = open("file", O_RDONLY);
if (fd < 0)
return 3;
if (fsync(fd))
return 4;
if (unlink("file"))
return 5;
puts("success");
return 0;
}
$ rm -f file && ./foo; echo $?
4
--
Eric Blake eblake AT redhat DOT com +1-801-349-2682
Libvirt virtualization library http://libvirt.org
--
Problem reports: http://cygwin.com/problems.html
FAQ: http://cygwin.com/faq/
Documentation: http://cygwin.com/docs.html
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
| webmaster | delorie software privacy |
| Copyright © 2019 by DJ Delorie | Updated Jul 2019 |