delorie.com/archives/browse.cgi | search |
Mailing-List: | contact cygwin-help AT cygwin DOT com; run by ezmlm |
List-Subscribe: | <mailto:cygwin-subscribe AT cygwin DOT com> |
List-Archive: | <http://sources.redhat.com/ml/cygwin/> |
List-Post: | <mailto:cygwin AT cygwin DOT com> |
List-Help: | <mailto:cygwin-help AT cygwin DOT com>, <http://sources.redhat.com/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 |
Message-ID: | <405FA14C.2010607@fangorn.ca> |
Date: | Mon, 22 Mar 2004 21:30:36 -0500 |
From: | Mark Blackburn <marklist AT fangorn DOT ca> |
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? |
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 <stdlib.h> #include <dirent.h> #include <unistd.h> #include <sys/stat.h> #include <stdio.h> 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/
webmaster | delorie software privacy |
Copyright © 2019 by DJ Delorie | Updated Jul 2019 |