1
0
mirror of https://github.com/postgres/postgres.git synced 2025-06-16 06:01:02 +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:45 +00:00
parent 9cb91f90c9
commit b8e5581d76
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.207 2008/04/18 06:48:38 heikki Exp $
* $PostgreSQL: pgsql/src/backend/commands/dbcommands.c,v 1.208 2008/04/18 17:05:45 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@ -1321,7 +1321,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 */
@ -1490,7 +1490,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)));
}
@ -1529,7 +1529,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