aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Robert C. Helling <helling@atdotde.de>2019-11-15 10:51:41 +0100
committerGravatar Dirk Hohndel <dirk@hohndel.org>2019-11-16 12:34:30 -0800
commit143da031cee94a7d44668be52f90f2b3ec33c822 (patch)
tree41e0849ab1a5a286d4b242936d025569835b3615
parentf370446236b170517f9eb248d5421e0f0e22002e (diff)
downloadsubsurface-143da031cee94a7d44668be52f90f2b3ec33c822.tar.gz
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 <helling@atdotde.de>
-rw-r--r--core/save-profiledata.c3
1 files changed, 2 insertions, 1 deletions
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 <errno.h>
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;