summaryrefslogtreecommitdiffstats
path: root/src/mesa
diff options
context:
space:
mode:
authorRafael Antognolli <[email protected]>2017-06-05 11:04:26 -0700
committerRafael Antognolli <[email protected]>2017-06-09 10:21:16 -0700
commitd42fc65bb3c8af6ed25baae17e6f2daec73338fc (patch)
tree1f3b36fbe3fdae255c8c2ba03a8ff0ce6c62dc08 /src/mesa
parent81e15a5dea2e50135a83d249944e12537f6b152e (diff)
mesa/main/debug: Check if we successfully reopened the ppm file.
Since we created the file, we should be able to reopen it for appending, but some weird filesystem error could cause that to be false. So simply check whether we could reopen it or not. CID: 1177144 Signed-off-by: Rafael Antognolli <[email protected]> Reviewed-by: Matt Turner <[email protected]>
Diffstat (limited to 'src/mesa')
-rw-r--r--src/mesa/main/debug.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/mesa/main/debug.c b/src/mesa/main/debug.c
index 7b76a949698..d7e0143a8f6 100644
--- a/src/mesa/main/debug.c
+++ b/src/mesa/main/debug.c
@@ -235,6 +235,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;