in reply to Re^3: failing to use getdents system call on Linux
in thread failing to use getdents system call on Linux

Yup, the problem was with unpack indeed... I changed the line below from:

my ( $ino, $off, $len, $name ) = unpack( "LLSZ*", $buf );

To:

my ( $ino, $off, $len, $name ) = unpack( "L!L!SZ*", $buf );

And the program finally worked as expected:

[me@localhost ~]$ ./test2.pl -d sample/ | head sample/xaaaaaaaaff sample/xaaaaaaabdu sample/xaaaaaaabjw sample/xaaaaaaaaos sample/xaaaaaaaalu sample/xaaaaaaaags sample/xaaaaaaabci sample/xaaaaaaabhy sample/xaaaaaaabjv sample/xaaaaaaaaxa

All good, but some questions remains:

  1. What could have happened that cause this change in the system? Originally I didn't need to worry about that. Maybe some change related going from 32 to 64 bits platforms?
  2. How can I double check if I need to use "native" sizes with the unpack template? Besides the program malfunctions, of course. :-)
Alceu Rodrigues de Freitas Junior
---------------------------------
"You have enemies? Good. That means you've stood up for something, sometime in your life." - Sir Winston Churchill