1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-28 23:42:10 +03:00

copydir() and rmtree() need to use lstat, not stat, to behave as expected

with symlinks.  Noted while trying to use rmtree in new C-code pg_regress.
This commit is contained in:
Tom Lane
2006-07-18 22:36:46 +00:00
parent 11b7aecbd4
commit 88295244be
2 changed files with 4 additions and 4 deletions

View File

@ -10,7 +10,7 @@
* Win32 (NT, Win2k, XP). replace() doesn't work on Win95/98/Me.
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/port/dirmod.c,v 1.42 2006/03/05 15:59:10 momjian Exp $
* $PostgreSQL: pgsql/src/port/dirmod.c,v 1.43 2006/07/18 22:36:46 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@ -434,7 +434,7 @@ rmtree(char *path, bool rmtopdir)
{
snprintf(filepath, MAXPGPATH, "%s/%s", path, *filename);
if (stat(filepath, &statbuf) != 0)
if (lstat(filepath, &statbuf) != 0)
goto report_and_fail;
if (S_ISDIR(statbuf.st_mode))