Bruno Haible <[EMAIL PROTECTED]> 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, http://www.google.fr/search?q=openat+site%3Adocs.sun.com 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. _______________________________________________ bug-gnulib mailing list bug-gnulib@gnu.org http://lists.gnu.org/mailman/listinfo/bug-gnulib