openbsd-ports/graphics/xpdf/patches/patch-aa
angelos 6c5ec374ec Version 0.7a
Thanks to toddf@ for telling me about the new version.
1998-05-16 00:28:27 +00:00

50 lines
1.2 KiB
Plaintext

*** xpdf/Stream.cc.orig Fri May 15 20:13:58 1998
--- xpdf/Stream.cc Fri May 15 20:18:10 1998
***************
*** 498,503 ****
--- 498,505 ----
void LZWStream::reset() {
FILE *f;
+ int fdfd;
+ char *zzzz;
str->reset();
bufPtr = bufEnd = buf;
***************
*** 513,524 ****
strcpy(zCmd, uncompressCmd);
strcat(zCmd, " ");
zName = zCmd + strlen(zCmd);
! tmpnam(zName);
strcat(zName, ".Z");
! if (!(f = fopen(zName, FOPEN_WRITE_BIN))) {
error(getPos(), "Couldn't open temporary file '%s'", zName);
return;
}
dumpFile(f);
fclose(f);
#ifdef HAVE_POPEN
--- 515,535 ----
strcpy(zCmd, uncompressCmd);
strcat(zCmd, " ");
zName = zCmd + strlen(zCmd);
! strcpy(zName, "/tmp/xpXXXXXXXX");
! zzzz = strdup(zName);
! fdfd = mkstemp(zzzz);
strcat(zName, ".Z");
! if (!(f = fdopen(fdfd, FOPEN_WRITE_BIN))) {
error(getPos(), "Couldn't open temporary file '%s'", zName);
+ free(zzzz);
return;
}
+ if (rename(zzzz, zName) == -1) {
+ error(getPos(), "Couldn't rename temporary file '%s'", zName);
+ free(zzzz);
+ return;
+ }
+ free(zzzz);
dumpFile(f);
fclose(f);
#ifdef HAVE_POPEN