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

Clean up some copied-and-pasted code in pg_upgrade.

1. Don't reimplement S_ISDIR() and S_ISREG() badly.
2. Don't reimplement access() badly.

This code appears to have been copied from ancient versions of the
corresponding backend routines, and not patched to incorporate subsequent
fixes (see my commits of 2008-03-31 and 2010-01-14 respectively).
It might be a good idea to change it to just *call* those routines,
but for now I'll just transpose these fixes over.
This commit is contained in:
Tom Lane
2010-12-11 14:17:46 -05:00
parent 1319002e2e
commit 3864afa1d1
2 changed files with 7 additions and 66 deletions

View File

@ -440,13 +440,13 @@ copy_dir(const char *src, const char *dst, bool force)
return -1;
}
if (fst.st_mode & S_IFDIR)
if (S_ISDIR(fst.st_mode))
{
/* recurse to handle subdirectories */
if (force)
copy_dir(src_file, dest_file, true);
}
else if (fst.st_mode & S_IFREG)
else if (S_ISREG(fst.st_mode))
{
if ((copy_file(src_file, dest_file, 1)) == -1)
{