From: John Darrington Date: Sat, 29 Aug 2020 06:26:23 +0000 (+0200) Subject: src/ui/gui/psppire-conf.c: Use GError instead of strerror. X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4cee6fc1f72440698ca8f3f89a71d29e7ee46a0d;p=pspp 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 --- 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);