From 143da031cee94a7d44668be52f90f2b3ec33c822 Mon Sep 17 00:00:00 2001 From: "Robert C. Helling" Date: Fri, 15 Nov 2019 10:51:41 +0100 Subject: Use the actual error number According to the man page, fopen and fclose return the error number in the global variable errno. Fixes CID 350115 Signed-off-by: Robert C. Helling --- core/save-profiledata.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'core') diff --git a/core/save-profiledata.c b/core/save-profiledata.c index bc5a8e3a5..87047a34a 100644 --- a/core/save-profiledata.c +++ b/core/save-profiledata.c @@ -6,6 +6,7 @@ #include "core/subsurface-string.h" #include "core/save-profiledata.h" #include "core/version.h" +#include static void put_int(struct membuffer *b, int val) { @@ -257,7 +258,7 @@ int save_profiledata(const char *filename, const bool select_only) error = fclose(f); } if (error) - report_error("Save failed (%s)", strerror(error)); + report_error("Save failed (%s)", strerror(errno)); free_buffer(&buf); return error; -- cgit v1.2.3-70-g09d2