[Top][All Lists]

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

[bug-gnulib] Re: new unlinkdir module for gnulib

From: Jim Meyering
Subject: [bug-gnulib] Re: new unlinkdir module for gnulib
Date: Fri, 20 May 2005 17:23:46 +0200

Bruno Haible <address@hidden> wrote:
> Why not add to gnulib a module with a function rmdir_recursive() instead?
> This function would remove a directory, including its contents.

coreutils' remove.c might fit the bill, in that it's robust.
But currently it's not strictly library-clean in the sense
that it generates diagnostics (via error()) and can even exit
in some unusual circumstances.

FWIW, if we had the openat et al functions,


it'd be pretty easy to eliminate the exit calls, since they all come
down to failures to return to an initial directory.  With openat,
there would be no need to change directory in the first place.

I'm constantly tempted to rewrite remove.c to use openat, since it's
such an obviously superior interface.  I'm considering this, in spite
of the fact that Linux doesn't (yet?) provide that functionality,
and that using the gnulib replacement function would impose a
performance penalty on losing (aka non-Solaris) systems.

gnulib's replacement function can fail in one way that native openat
cannot, since the former must rely on calling fchdir to change
to the destination directory, and then has to return to the initial
directory.  It's upon failed return-to-previous-directory that the
openat replacement currently exits.

reply via email to

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