Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com Date: Wed, 10 Jul 2002 15:39:43 +0200 From: Pavel Tsekov Reply-To: Pavel Tsekov Organization: Syntrex, Inc. X-Priority: 3 (Normal) Message-ID: <823876622.20020710153943@syntrex.com> To: cygwin AT cygwin DOT com Subject: [BUG] open(): Opening with flags O_RDONLY | O_APPEND positions the file pointer at the end of the file MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="----------94D4A226060524" Note-from-DJ: This may be spam ------------94D4A226060524 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Hello, there :) Attached is a testcase which displays the problem. On Linux it will properly return 13, while on cygwin it returns 0. I found this while trying to understand why MC doesn't extract properly files from say .zip files. I don't know exactly why they call O_RDONLY combined with O_APPEND but I will mail the mc-devel list ASAP. Still according to the Linux man page and SUSv2, O_APPEND should be taken into account only when writing to the file. Having in mind that fhandler_base::write() calls SetFilePointer before each write, I wonder why fhandler_disk_base::open calls SetFilePointer when it detects O_APPEND ? ------------94D4A226060524 Content-Type: application/octet-stream; name="open_test.c" Content-Transfer-Encoding: base64 Content-Disposition: attachment; filename="open_test.c" I2luY2x1ZGUgPHN0ZGlvLmg+CiNpbmNsdWRlIDxzeXMvdHlwZXMuaD4KI2luY2x1ZGUgPHN5cy9z dGF0Lmg+CiNpbmNsdWRlIDxmY250bC5oPgoKaW50IG1haW4gKGludCBhcmdjLCBjaGFyICoqYXJn dikKewogIGludCBmOwogIGludCBydjsKICBjaGFyIGJ1Zls4MTkyXTsKCiAgZiA9IG9wZW4gKCIv dG1wL3h4eHl5eXp6ei5kYXQiLCBPX1JEV1IgfCBPX0NSRUFUIHwgT19UUlVOQywgMDYwMCk7CiAg d3JpdGUgKGYsICJIZWxsbywgd29ybGQhIiwgMTMpOwogIGNsb3NlIChmKTsKICBmID0gb3BlbiAo Ii90bXAveHh4eXl5enp6LmRhdCIsIE9fUkRPTkxZIHwgT19BUFBFTkQpOwogIHJ2ID0gcmVhZCAo ZiwgYnVmLCA4MTkyKTsKICBjbG9zZSAoZik7CiAgcHJpbnRmICgiUmVkICVkIGJ5dGVzIVxuIiwg cnYpOwogIHJldHVybiAwOwp9Cg== ------------94D4A226060524 Content-Type: text/plain; charset=us-ascii -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Bug reporting: http://cygwin.com/bugs.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/ ------------94D4A226060524--