diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2005-08-02 15:14:56 +0000 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2005-08-02 15:14:56 +0000 |
commit | 668448d6f035333e7df0db8d21571eec01e4c519 (patch) | |
tree | 23c2cbc04215f2286e5d9aa4b0c846943b3a4dac /src | |
parent | ae1d34f23ab361df3e05163fe83766b4a14e740d (diff) | |
download | postgresql-668448d6f035333e7df0db8d21571eec01e4c519.tar.gz postgresql-668448d6f035333e7df0db8d21571eec01e4c519.zip |
rmtree() reported the wrong pathname if final rmdir failed.
Diffstat (limited to 'src')
-rw-r--r-- | src/port/dirmod.c | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/src/port/dirmod.c b/src/port/dirmod.c index e8e40775aa5..b4374e95e5a 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.34.4.2 2005/03/24 02:11:33 tgl Exp $ + * $PostgreSQL: pgsql/src/port/dirmod.c,v 1.34.4.3 2005/08/02 15:14:56 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -280,10 +280,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); @@ -407,7 +407,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; @@ -422,6 +423,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++) { @@ -449,7 +451,8 @@ rmtree(char *path, bool rmtopdir) if (rmtopdir) { - if (rmdir(path) != 0) + filepath = path; + if (rmdir(filepath) != 0) goto report_and_fail; } |