On Thu, May 14, 2009 at 5:47 PM, Ryan Flannery <[email protected]>
wrote:
...
> I can get the inode of the file with ls(1), and used that to write the
> following program which I thought would help, but sadly it too fails.
...
>   /* open directory */
>   DIR *usr;
>   if ((usr = opendir("/usr")) == NULL)
>      err(1, "failed to opendir");
...
>         /* cross fingers */
>         printf("\n\nattempting to unlink...\n");
>         if (unlink(entry->d_name) < 0)
>            err(1, "failure, crack 'nother beer");
...
> Questions:
> 1.  Any whacks of a clue-stick would be greatly appreciated.

So you listed /usr and found the problem name and then you try to
remove that file from your current directory.  Is your current
directory /usr ?


> 2.  When I printf dirent struct's d_namlen field, is says 302...
> grep'ing /usr/include, isn't this 255?  How can this happen?

Hmm, what type of filesystem is /usr ?


> 3.  Passing the d_name field directly to unlink(2)... this should
> work, correct?  (I tried this with a sample setup elsewhere and it
> did).  Any thoughts why this would fail?

Yes, modulus current vs listed directory issues.


Philip Guenther

Reply via email to