Index: bin/pg_dump/pg_backup_tar.c =================================================================== RCS file: /projects/cvsroot/pgsql/src/bin/pg_dump/pg_backup_tar.c,v retrieving revision 1.50 diff -c -r1.50 pg_backup_tar.c *** bin/pg_dump/pg_backup_tar.c 12 Feb 2006 06:11:50 -0000 1.50 --- bin/pg_dump/pg_backup_tar.c 20 Apr 2006 08:45:03 -0000 *************** *** 68,73 **** --- 68,74 ---- FILE *tarFH; FILE *tmpFH; char *targetFile; + char *tempFile; char mode; off_t pos; off_t fileLen; *************** *** 360,370 **** } else { tm = calloc(1, sizeof(TAR_MEMBER)); ! tm->tmpFH = tmpfile(); ! if (tm->tmpFH == NULL) die_horribly(AH, modulename, "could not generate temporary file name: %s\n", strerror(errno)); #ifdef HAVE_LIBZ --- 361,378 ---- } else { + char *tmpname; tm = calloc(1, sizeof(TAR_MEMBER)); ! tmpname = tempnam(NULL, NULL); ! if (tmpname != NULL) ! { ! tm->tempFile = strdup(tmpname); ! if (tm->tempFile != NULL) ! tm->tmpFH = fopen(tm->tempFile , "w+b"); ! } ! if (tmpname == NULL || tm->tempFile == NULL || tm->tmpFH == NULL) die_horribly(AH, modulename, "could not generate temporary file name: %s\n", strerror(errno)); #ifdef HAVE_LIBZ *************** *** 1040,1047 **** len += res; } ! if (fclose(tmp) != 0) /* This *should* delete it... */ die_horribly(AH, modulename, "could not close tar member: %s\n", strerror(errno)); if (len != th->fileLen) { --- 1048,1060 ---- len += res; } ! if (fclose(tmp) != 0) die_horribly(AH, modulename, "could not close tar member: %s\n", strerror(errno)); + if (th->tempFile != NULL) + { + unlink(th->tempFile); + free(th->tempFile); + } if (len != th->fileLen) {