[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

nftw/ftw: additional functionality required

From: Jim Meyering
Subject: nftw/ftw: additional functionality required
Date: Fri, 17 Jan 2003 11:23:54 +0100

When nftw fails because it cannot fchdir (in FTW_CHDIR mode, of course)
into a directory that it *can* read, nftw merely returns -1.  There is
currently no way for an application like du to give a proper diagnostic
indicating precisely which directory evoked the failure.

I propose that nftw/ftw treat this situation similarly to the one for
`directory not readable' (FTW_DNR) and call the user-supplied callback
with a new value indicating the chdir failed.  Of course, in this new
case (unlike for FTW_DNR), we won't be able to fill in the `struct stat'
member, but that's ok.  All I want is the file name so du can give a
proper diagnostic.

My current implementation of du.c (using nftw) exhibits the problem
like this:

  $ mkdir -p d/no-x/y
  $ chmod u=rw d/no-x
  $ ./du d
  ./du: `d': Permission denied
  [Exit 1]

There should be an easy way to determine that the problem is with `d/no-x',
not just `d'.

Attachment: pgpOfM5OHfiJO.pgp
Description: PGP signature

reply via email to

[Prev in Thread] Current Thread [Next in Thread]