tags 405048 patch thanks Hello. The following quick patch seems to fix this problem.
--- a/pbm/pbmtextps.c 2004-01-05 10:39:56.000000000 +0000 +++ b/pbm/pbmtextps.c 2010-05-05 23:49:57.000000000 +0000 @@ -265,7 +265,7 @@ if(fwrite(ps, 1, strlen(ps), psfile) != strlen(ps)) pm_error("Can't write postscript to temp file"); - fclose(psfile); + fflush(psfile); if (cmdl->verbose) pm_message("Running Postscript interpreter '%s'", com); @@ -275,7 +275,7 @@ free(com); - pbmfile = pm_openw(pbmfname); + pbmfile = pm_openr(pbmfname); com = crop_command(); if(com) {
The temporary PostScript file was being closed twice, which caused a glibc error. The first fclose appears to have been inserted to make sure the text is written to the file before gs is invoked, so I replaced it with fflush instead. Futhermore, the temporary pbm file created by gs was for some reason opened for writing, and thus truncated, before the invocatoin of pnmcrop to crop it. Perhaps this was intended as a test of whether the pbm file exists before proceeding, so I just changed this so the pbm file is opened for reading instead.