From 4cee6fc1f72440698ca8f3f89a71d29e7ee46a0d Mon Sep 17 00:00:00 2001 From: John Darrington Date: Sat, 29 Aug 2020 08:26:23 +0200 Subject: [PATCH] src/ui/gui/psppire-conf.c: Use GError instead of strerror. Apparently the use of strerror was causing problems on certain platforms. In this case, since the function being checked provides a GError argument it makes sense to use that instead. Closes bug #59034 --- src/ui/gui/psppire-conf.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/ui/gui/psppire-conf.c b/src/ui/gui/psppire-conf.c index 1f5914ed72..60cbc0cedd 100644 --- a/src/ui/gui/psppire-conf.c +++ b/src/ui/gui/psppire-conf.c @@ -50,11 +50,12 @@ flush_conf (PsppireConf *conf) gsize length = 0; gchar *kf = g_key_file_to_data (conf->keyfile, &length, NULL); + GError *err = NULL; - if (! g_file_set_contents (conf->filename, kf, length, NULL)) + if (! g_file_set_contents (conf->filename, kf, length, &err)) { - char *msg = strerror (errno); - g_warning ("Cannot open %s for writing: %s", conf->filename, msg); + g_warning ("Cannot open %s for writing: %s", conf->filename, err->message); + g_error_free (err); } g_free (kf); -- 2.30.2