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.

[EMAIL PROTECTED] ~
$ 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); }

[EMAIL PROTECTED] ~
$ gcc testcase.c -o testcase

[EMAIL PROTECTED] ~
$ mkdir d

[EMAIL PROTECTED] ~
$ ./testcase.exe
inode of d:17489383932880356520

[EMAIL PROTECTED] ~
$ ls -id d
3659174697343209 d/

[EMAIL PROTECTED] ~
$

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/



Reply via email to