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 Message-ID: <405FA14C.2010607@fangorn.ca> Date: Mon, 22 Mar 2004 21:30:36 -0500 From: Mark Blackburn Reply-To: cygwin AT cygwin DOT com User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.6b) Gecko/20031205 Thunderbird/0.4 MIME-Version: 1.0 To: cygwin AT cygwin DOT com Subject: How do you fstat an open directory? Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-IsSubscribed: yes I've been trying to get chgrp -R from coreutils working and I ran up against this problem. I can't properly stat a directory whose file descriptor I get from the dirfd function/macro. mark AT althor ~ $ cat > testcase.c #include #include #include #include #include int main() { DIR *dirp; int fd; struct stat sb; dirp = opendir("d"); fd = dirfd(dirp); fstat(fd, &sb); printf("inode of d:%llu\n", sb.st_ino); } mark AT althor ~ $ gcc testcase.c -o testcase mark AT althor ~ $ mkdir d mark AT althor ~ $ ./testcase.exe inode of d:17489383932880356520 mark AT althor ~ $ ls -id d 3659174697343209 d/ mark AT althor ~ $ Notice that the inodes don't match from ls -id and from my test program. Am I doing something wrong? Mark Blackburn -- 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/