summaryrefslogtreecommitdiff
path: root/src/port/dirmod.c
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2005-08-02 15:14:47 +0000
committerTom Lane <tgl@sss.pgh.pa.us>2005-08-02 15:14:47 +0000
commit9216c8999affbb2df78173665a215f4b3198de48 (patch)
tree51929557aa5288c0caf3e2ef150a8b7629985585 /src/port/dirmod.c
parent35c4764f887e97415b81bb5f10612f898bc68f5f (diff)
rmtree() reported the wrong pathname if final rmdir failed.
Diffstat (limited to 'src/port/dirmod.c')
-rw-r--r--src/port/dirmod.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/src/port/dirmod.c b/src/port/dirmod.c
index a31cfca0813..c2863e205f4 100644
--- a/src/port/dirmod.c
+++ b/src/port/dirmod.c
@@ -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.37 2005/03/24 02:11:20 tgl Exp $
+ * $PostgreSQL: pgsql/src/port/dirmod.c,v 1.38 2005/08/02 15:14:47 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -281,10 +281,10 @@ pgsymlink(const char *oldpath, const char *newpath)
#ifndef FRONTEND
ereport(ERROR,
(errcode_for_file_access(),
- errmsg("Error setting junction for %s: %s",
+ errmsg("could not set junction for \"%s\": %s",
nativeTarget, msg)));
#else
- fprintf(stderr, _("Error setting junction for %s: %s\n"),
+ fprintf(stderr, _("could not set junction for \"%s\": %s\n"),
nativeTarget, msg);
#endif
LocalFree(msg);
@@ -408,7 +408,8 @@ fnames_cleanup(char **filenames)
bool
rmtree(char *path, bool rmtopdir)
{
- char filepath[MAXPGPATH];
+ char pathbuf[MAXPGPATH];
+ char *filepath;
char **filenames;
char **filename;
struct stat statbuf;
@@ -423,6 +424,7 @@ rmtree(char *path, bool rmtopdir)
return false;
/* now we have the names we can start removing things */
+ filepath = pathbuf;
for (filename = filenames; *filename; filename++)
{
@@ -450,7 +452,8 @@ rmtree(char *path, bool rmtopdir)
if (rmtopdir)
{
- if (rmdir(path) != 0)
+ filepath = path;
+ if (rmdir(filepath) != 0)
goto report_and_fail;
}