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>
This commit is contained in:
Robert C. Helling 2019-11-15 10:51:41 +01:00 committed by Dirk Hohndel
parent f370446236
commit 143da031ce

View file

@ -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;