shithub: puzzles

Download patch

ref: baed0e3eec513aa148afaea950b43a4f8b8d2734
parent: f281644b0be91917b7f9f43d7496140173d7ed2e
author: Simon Tatham <anakin@pobox.com>
date: Tue Nov 6 13:33:21 EST 2018

Fix a misuse of errno.

In menu_save_event, we checked ctx.error to see if an errno value had
been left in it by the savefile_write callback, but if so, then we
were passing the _current_ value of errno to strerror() in place of
the saved value in ctx.error.

This may well have been benign, but I spotted it in an eyeball review
just now and thought I'd better fix it before it bit anyone.

--- a/gtk.c
+++ b/gtk.c
@@ -2287,7 +2287,7 @@
 	    if (ctx.error) {
 		char boxmsg[512];
 		sprintf(boxmsg, "Error writing save file: %.400s",
-			strerror(errno));
+			strerror(ctx.error));
 		error_box(fe->window, boxmsg);
 		goto free_and_return;
 	    }