X-Git-Url: https://git.libre-soc.org/?a=blobdiff_plain;f=src%2Fmesa%2Fmain%2Fdebug.c;h=b1fa1f067ff2a14d65e9071edf4b4a7acf361d4b;hb=2d115056d3d847e524dead44e9ff255a3cf8127e;hp=7b76a94969871df918ab6723341c2c4353ed9d57;hpb=96a1c2406db4ac79335a7f6e6d61d80d985df76e;p=mesa.git diff --git a/src/mesa/main/debug.c b/src/mesa/main/debug.c index 7b76a949698..b1fa1f067ff 100644 --- a/src/mesa/main/debug.c +++ b/src/mesa/main/debug.c @@ -24,6 +24,7 @@ */ #include +#include "errors.h" #include "mtypes.h" #include "attrib.h" #include "enums.h" @@ -235,6 +236,11 @@ write_ppm(const char *filename, const GLubyte *buffer, int width, int height, fprintf(f,"255\n"); fclose(f); f = fopen( filename, "ab" ); /* reopen in binary append mode */ + if (!f) { + fprintf(stderr, "Error while reopening %s in write_ppm()\n", + filename); + return; + } for (y=0; y < height; y++) { for (x = 0; x < width; x++) { int yy = invert ? (height - 1 - y) : y;