summaryrefslogtreecommitdiff
path: root/contrib/pg_upgrade/file.c
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2010-12-11 14:17:46 -0500
committerTom Lane <tgl@sss.pgh.pa.us>2010-12-11 14:17:46 -0500
commit3864afa1d1478f7a76fde1ea160a7bc8f5d5b203 (patch)
tree6e37227d955beb2b6646a2b6bf9cb379ef70754c /contrib/pg_upgrade/file.c
parent1319002e2ee166c06b38cdbc5e8508c7205fa115 (diff)
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.
Diffstat (limited to 'contrib/pg_upgrade/file.c')
-rw-r--r--contrib/pg_upgrade/file.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/contrib/pg_upgrade/file.c b/contrib/pg_upgrade/file.c
index 1b25a212c0b..e84110665fe 100644
--- a/contrib/pg_upgrade/file.c
+++ b/contrib/pg_upgrade/file.c
@@ -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)
{