X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=gio%2Fgio-querymodules.c;h=8dc2421a3666b2db5481a3d30bae305cf861c2dc;hb=d9ad40b4eaf1a9197ab363de4346a8d84f45f5c1;hp=716a7b8d13eb5cdd2e20c49ad3c839b61f69d880;hpb=d8ca6404229e5b64d2bf2e1a3660ad9fe7feefdd;p=platform%2Fupstream%2Fglib.git
diff --git a/gio/gio-querymodules.c b/gio/gio-querymodules.c
index 716a7b8..8dc2421 100644
--- a/gio/gio-querymodules.c
+++ b/gio/gio-querymodules.c
@@ -13,9 +13,7 @@
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General
- * Public License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place, Suite 330,
- * Boston, MA 02111-1307, USA.
+ * Public License along with this library; if not, see .
*
* Author: Alexander Larsson
*/
@@ -23,6 +21,9 @@
#include "config.h"
#include "giomodule.h"
+#include
+#include
+
static gboolean
is_valid_module_name (const gchar *basename)
{
@@ -101,11 +102,20 @@ query_dir (const char *dirname)
cachename = g_build_filename (dirname, "giomodule.cache", NULL);
- error = NULL;
- if (!g_file_set_contents (cachename, data->str, data->len, &error))
+ if (data->len > 0)
{
- g_printerr ("Unable to create %s: %s\n", cachename, error->message);
- g_error_free (error);
+ error = NULL;
+
+ if (!g_file_set_contents (cachename, data->str, data->len, &error))
+ {
+ g_printerr ("Unable to create %s: %s\n", cachename, error->message);
+ 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);
@@ -117,8 +127,6 @@ main (gint argc,
{
int i;
- g_type_init ();
-
if (argc == 1)
{
g_print ("Usage: gio-querymodules [ ...]\n");
@@ -126,6 +134,9 @@ main (gint argc,
return 1;
}
+ /* Be defensive and ensure we're linked to GObject */
+ g_type_ensure (G_TYPE_OBJECT);
+
for (i = 1; i < argc; i++)
query_dir (argv[i]);