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: Sun, 18 Sep 2005 15:22:56 -0700 From: Yitzchak Scott-Thoennes To: cygwin AT cygwin DOT com Subject: fstat gives wrong mode after chmod and fchmod Message-ID: <20050918222256.GA3420@efn.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.4.2.1i X-IsSubscribed: yes I'm seeing this on the 20050916 but as far as I know it's not a regression. A new perl test (actually using an existing file opened for read access) turned this up. The following gives: after fchmod to 0 and chmod to 0666, stat: 666 fstat: 444 #include #include #include int main(int argc, char **argv) { int fd; struct stat statbuf, fstatbuf; if ( ( fd = open("foo", O_CREAT|O_EXCL|O_WRONLY, 0666) ) < 0 ) { perror("open failed"); return 1; } if ( fchmod(fd, 0) ) { perror("fchmod failed"); return 1; } if ( chmod("foo", 0666) ) { perror("chmod failed"); return 1; } if ( stat("foo", &statbuf) ) { perror("stat failed"); return 1; } if ( fstat(fd, &fstatbuf) ) { perror("fstat failed"); return 1; } printf("after fchmod to 0 and chmod to 0666, stat: %o fstat: %o\n", statbuf.st_mode & 0777, fstatbuf.st_mode & 0777); return 0; } -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Problem reports: http://cygwin.com/problems.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/