1
0
mirror of https://github.com/postgres/postgres.git synced 2025-08-24 09:27:52 +03:00

Fix rmtree() so that it keeps going after failure to remove any individual

file; the idea is that we should clean up as much as we can, even if there's
some problem removing one file.  Make the error messages a bit less misleading,
too.  In passing, const-ify function arguments.
This commit is contained in:
Tom Lane
2008-04-18 17:05:53 +00:00
parent b8c5823082
commit 2101518516
3 changed files with 53 additions and 38 deletions

View File

@@ -13,7 +13,7 @@
*
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/commands/dbcommands.c,v 1.204.2.2 2008/04/18 06:48:50 heikki Exp $
* $PostgreSQL: pgsql/src/backend/commands/dbcommands.c,v 1.204.2.3 2008/04/18 17:05:53 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -1320,7 +1320,7 @@ remove_dbtablespaces(Oid db_id)
if (!rmtree(dstpath, true))
ereport(WARNING,
(errmsg("could not remove database directory \"%s\"",
(errmsg("some useless files may be left behind in old database directory \"%s\"",
dstpath)));
/* Record the filesystem change in XLOG */
@@ -1489,7 +1489,7 @@ dbase_redo(XLogRecPtr lsn, XLogRecord *record)
{
if (!rmtree(dst_path, true))
ereport(WARNING,
(errmsg("could not remove database directory \"%s\"",
(errmsg("some useless files may be left behind in old database directory \"%s\"",
dst_path)));
}
@@ -1528,7 +1528,7 @@ dbase_redo(XLogRecPtr lsn, XLogRecord *record)
/* And remove the physical files */
if (!rmtree(dst_path, true))
ereport(WARNING,
(errmsg("could not remove database directory \"%s\"",
(errmsg("some useless files may be left behind in old database directory \"%s\"",
dst_path)));
}
else