diff options
author | Tom Lane | 2006-07-18 22:36:46 +0000 |
---|---|---|
committer | Tom Lane | 2006-07-18 22:36:46 +0000 |
commit | ae432fc211fd4ad53f41a8a5cddd12f1dd45ff12 (patch) | |
tree | 9e54da50ba91b7c7f1d478074b3429d861e65239 | |
parent | 12cc663c47717ad78def0f635915542df459d756 (diff) |
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.
-rw-r--r-- | src/port/copydir.c | 2 | ||||
-rw-r--r-- | src/port/dirmod.c | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/src/port/copydir.c b/src/port/copydir.c index 45659864cd..023b46dda7 100644 --- a/src/port/copydir.c +++ b/src/port/copydir.c @@ -75,7 +75,7 @@ copydir(char *fromdir, char *todir, bool recurse) snprintf(fromfile, MAXPGPATH, "%s/%s", fromdir, xlde->d_name); snprintf(tofile, MAXPGPATH, "%s/%s", todir, xlde->d_name); - if (stat(fromfile, &fst) < 0) + if (lstat(fromfile, &fst) < 0) ereport(ERROR, (errcode_for_file_access(), errmsg("could not stat file \"%s\": %m", fromfile))); diff --git a/src/port/dirmod.c b/src/port/dirmod.c index 14f42daa7a..292a6d103b 100644 --- a/src/port/dirmod.c +++ b/src/port/dirmod.c @@ -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)) |