mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2024-12-25 15:06:14 +01:00
gio-querymodules: unlink instead of writing empty cache
If there are no modules installed then the most appropriate thing is to have no cachefile instead of an empty one. This unbreaks the "clean directory after 'make uninstall'" check that automake does. https://bugzilla.gnome.org/show_bug.cgi?id=671664
This commit is contained in:
parent
c9f55445aa
commit
3fa7358487
@ -23,6 +23,9 @@
|
|||||||
#include "config.h"
|
#include "config.h"
|
||||||
#include "giomodule.h"
|
#include "giomodule.h"
|
||||||
|
|
||||||
|
#include <gstdio.h>
|
||||||
|
#include <errno.h>
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
is_valid_module_name (const gchar *basename)
|
is_valid_module_name (const gchar *basename)
|
||||||
{
|
{
|
||||||
@ -101,12 +104,21 @@ query_dir (const char *dirname)
|
|||||||
|
|
||||||
cachename = g_build_filename (dirname, "giomodule.cache", NULL);
|
cachename = g_build_filename (dirname, "giomodule.cache", NULL);
|
||||||
|
|
||||||
|
if (data->len > 0)
|
||||||
|
{
|
||||||
error = NULL;
|
error = NULL;
|
||||||
|
|
||||||
if (!g_file_set_contents (cachename, data->str, data->len, &error))
|
if (!g_file_set_contents (cachename, data->str, data->len, &error))
|
||||||
{
|
{
|
||||||
g_printerr ("Unable to create %s: %s\n", cachename, error->message);
|
g_printerr ("Unable to create %s: %s\n", cachename, error->message);
|
||||||
g_error_free (error);
|
g_error_free (error);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (g_unlink (cachename) != 0 && errno != ENOENT)
|
||||||
|
g_printerr ("Unable to unlink %s: %s\n", cachename, g_strerror (errno));
|
||||||
|
}
|
||||||
|
|
||||||
g_string_free (data, TRUE);
|
g_string_free (data, TRUE);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user