with this program; if not, write to the Free Software Foundation, Inc.,
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
-#include "system.h"
+#include <system.h>
#include <getline.h>
#include <hash.h>
#include <quotearg.h>
#include "common.h"
-#define obstack_chunk_alloc xmalloc
-#define obstack_chunk_free free
-#include <obstack.h>
/* Incremental dump specialities. */
/* Restoration of incremental dumps. */
/* Examine the directories under directory_name and delete any
- files that were not there at the time of the back-up.
- FIXME: The function name is obviously a misnomer */
+ files that were not there at the time of the back-up. */
void
-gnu_restore (char const *directory_name)
+purge_directory (char const *directory_name)
{
char *archive_dir;
char *current_dir;
}
if (*arc == '\0')
{
+ struct stat st;
char *p = new_name (directory_name, cur);
+
+ if (deref_stat (true, p, &st))
+ {
+ stat_diag (p);
+ WARN((0, 0, _("%s: Not purging directory: unable to stat"),
+ quotearg_colon (p)));
+ continue;
+ }
+ else if (one_file_system_option && st.st_dev != root_device)
+ {
+ WARN((0, 0,
+ _("%s: directory is on a different device: not purging"),
+ quotearg_colon (p)));
+ continue;
+ }
+
if (! interactive_option || confirm ("delete", p))
{
if (verbose_option)
fprintf (stdlis, _("%s: Deleting %s\n"),
program_name, quote (p));
- if (! remove_any_file (p, 1))
+ if (! remove_any_file (p, RECURSIVE_REMOVE_OPTION))
{
int e = errno;
ERROR ((0, e, _("%s: Cannot remove"), quotearg_colon (p)));