@@ -34,35 +34,35 @@ void setup() {
3434}
3535
3636int main () {
37- setup ();
38- int res = open ("b" , O_CREAT , 0777 );
39- assert (res >= 0 );
40- assert (close (res ) == 0 );
41- assert (symlink ("b" , "a" ) == 0 );
42- int dirfd = open ("." , O_RDONLY );
43- assert (dirfd > 0 );
44- DIR * dirp ;
45- dirp = fdopendir (dirfd );
46- assert (dirp != NULL );
47- struct dirent * ep ;
48- int a_ino = -1 ;
49- int b_ino = -1 ;
50- while ((ep = readdir (dirp ))) {
51- if (strcmp (ep -> d_name , "a" ) == 0 ) {
52- a_ino = ep -> d_ino ;
53- }
54- if (strcmp (ep -> d_name , "b" ) == 0 ) {
55- b_ino = ep -> d_ino ;
56- }
37+ setup ();
38+ int res = open ("b" , O_CREAT , 0777 );
39+ assert (res >= 0 );
40+ assert (close (res ) == 0 );
41+ assert (symlink ("b" , "a" ) == 0 );
42+ int dirfd = open ("." , O_RDONLY );
43+ assert (dirfd > 0 );
44+ DIR * dirp ;
45+ dirp = fdopendir (dirfd );
46+ assert (dirp != NULL );
47+ struct dirent * ep ;
48+ int a_ino = -1 ;
49+ int b_ino = -1 ;
50+ while ((ep = readdir (dirp ))) {
51+ if (strcmp (ep -> d_name , "a" ) == 0 ) {
52+ a_ino = ep -> d_ino ;
5753 }
58- assert (a_ino >= 0 );
59- assert (b_ino >= 0 );
60- struct stat sta , stb ;
61- assert (lstat ("a" , & sta ) == 0 );
62- assert (lstat ("b" , & stb ) == 0 );
63- printf ("readdir a_ino: %d, b_ino: %d\n" , a_ino , b_ino );
64- printf ("stat a_ino: %llu, b_ino: %llu\n" , sta .st_ino , stb .st_ino );
65- assert (a_ino == sta .st_ino );
66- assert (b_ino == stb .st_ino );
67- printf ("success\n" );
54+ if (strcmp (ep -> d_name , "b" ) == 0 ) {
55+ b_ino = ep -> d_ino ;
56+ }
57+ }
58+ assert (a_ino >= 0 );
59+ assert (b_ino >= 0 );
60+ struct stat sta , stb ;
61+ assert (lstat ("a" , & sta ) == 0 );
62+ assert (lstat ("b" , & stb ) == 0 );
63+ printf ("readdir a_ino: %d, b_ino: %d\n" , a_ino , b_ino );
64+ printf ("stat a_ino: %llu, b_ino: %llu\n" , sta .st_ino , stb .st_ino );
65+ assert (a_ino == sta .st_ino );
66+ assert (b_ino == stb .st_ino );
67+ printf ("success\n" );
6868}
0 commit comments