Index: src/port/dirmod.c =================================================================== RCS file: /cvsroot/pgsql/src/port/dirmod.c,v retrieving revision 1.34 diff -c -c -r1.34 dirmod.c *** src/port/dirmod.c 31 Dec 2004 22:03:53 -0000 1.34 --- src/port/dirmod.c 13 Feb 2005 01:51:35 -0000 *************** *** 350,355 **** --- 350,356 ---- return filenames; } + /* * fnames_cleanup * *************** *** 366,371 **** --- 367,373 ---- pfree(filenames); } + /* * rmtree * *************** *** 398,413 **** snprintf(filepath, MAXPGPATH, "%s/%s", path, *filename); if (stat(filepath, &statbuf) != 0) ! { ! fnames_cleanup(filenames); ! return false; ! } if (S_ISDIR(statbuf.st_mode)) { /* call ourselves recursively for a directory */ if (!rmtree(filepath, true)) { fnames_cleanup(filenames); return false; } --- 400,413 ---- snprintf(filepath, MAXPGPATH, "%s/%s", path, *filename); if (stat(filepath, &statbuf) != 0) ! goto report_and_fail; if (S_ISDIR(statbuf.st_mode)) { /* call ourselves recursively for a directory */ if (!rmtree(filepath, true)) { + /* we already reported the error */ fnames_cleanup(filenames); return false; } *************** *** 415,436 **** else { if (unlink(filepath) != 0) ! { ! fnames_cleanup(filenames); ! return false; ! } } } if (rmtopdir) { if (rmdir(path) != 0) ! { ! fnames_cleanup(filenames); ! return false; ! } } fnames_cleanup(filenames); return true; } --- 415,440 ---- else { if (unlink(filepath) != 0) ! goto report_and_fail; } } if (rmtopdir) { if (rmdir(path) != 0) ! goto report_and_fail; } fnames_cleanup(filenames); return true; + + report_and_fail: + + #ifndef FRONTEND + elog(WARNING, "can not remove \"%s\": %s", filepath, strerror(errno)); + #else + fprintf(stderr, "can not remove \"%s\": %s\n", filepath, strerror(errno)); + #endif + fnames_cleanup(filenames); + return false; }