}
else
{
- if (!write_card32 (cache, (guint32) image->image_data ? image->image_data->offset : 0))
+ if (!write_card32 (cache, (guint32) (image->image_data ? image->image_data->offset : 0)))
return FALSE;
}
if (!_gtk_icon_cache_validate (&info))
{
- g_mapped_file_free (map);
+ g_mapped_file_unref (map);
return FALSE;
}
- g_mapped_file_free (map);
+ g_mapped_file_unref (map);
return TRUE;
}
struct utimbuf utime_buf;
GList *directories = NULL;
int fd;
+ int retry_count = 0;
#ifndef G_OS_WIN32
mode_t mode = S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH;
#else
#endif
tmp_cache_path = g_build_filename (path, "."CACHE_NAME, NULL);
+ cache_path = g_build_filename (path, CACHE_NAME, NULL);
+opentmp:
if ((fd = g_open (tmp_cache_path, O_WRONLY | O_CREAT | O_EXCL | O_TRUNC | _O_BINARY, mode)) == -1)
{
+ if (force_update && retry_count == 0)
+ {
+ retry_count++;
+ g_remove (tmp_cache_path);
+ goto opentmp;
+ }
g_printerr (_("Failed to open file %s : %s\n"), tmp_cache_path, g_strerror (errno));
exit (1);
}
fclose (cache);
g_unlink (tmp_cache_path);
+ g_unlink (cache_path);
exit (0);
}
if (!validate_file (tmp_cache_path))
{
g_printerr (_("The generated cache was invalid.\n"));
- //g_unlink (tmp_cache_path);
+ /*g_unlink (tmp_cache_path);*/
exit (1);
}
- cache_path = g_build_filename (path, CACHE_NAME, NULL);
-
#ifdef G_OS_WIN32
if (g_file_test (cache_path, G_FILE_TEST_EXISTS))
{
g_unlink (bak_cache_path);
if (g_rename (cache_path, bak_cache_path) == -1)
{
+ int errsv = errno;
+
g_printerr (_("Could not rename %s to %s: %s, removing %s then.\n"),
cache_path, bak_cache_path,
- g_strerror (errno),
+ g_strerror (errsv),
cache_path);
g_unlink (cache_path);
bak_cache_path = NULL;
if (g_rename (tmp_cache_path, cache_path) == -1)
{
+ int errsv = errno;
+
g_printerr (_("Could not rename %s to %s: %s\n"),
tmp_cache_path, cache_path,
- g_strerror (errno));
+ g_strerror (errsv));
g_unlink (tmp_cache_path);
#ifdef G_OS_WIN32
if (bak_cache_path != NULL)
if (g_rename (bak_cache_path, cache_path) == -1)
- g_printerr (_("Could not rename %s back to %s: %s.\n"),
- bak_cache_path, cache_path,
- g_strerror (errno));
+ {
+ errsv = errno;
+
+ g_printerr (_("Could not rename %s back to %s: %s.\n"),
+ bak_cache_path, cache_path,
+ g_strerror (errsv));
+ }
#endif
exit (1);
}
setlocale (LC_ALL, "");
+#ifdef ENABLE_NLS
bindtextdomain (GETTEXT_PACKAGE, GTK_LOCALEDIR);
+#ifdef HAVE_BIND_TEXTDOMAIN_CODESET
bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
+#endif
+#endif
context = g_option_context_new ("ICONPATH");
g_option_context_add_main_entries (context, args, GETTEXT_PACKAGE);
{
if (path)
{
- g_printerr (_("No theme index file."));
+ g_printerr (_("No theme index file.\n"));
}
else
{