No need to g_access when checking cached file, fopen is enough
This commit is contained in:
parent
eddb3ef557
commit
61266c26ec
1 changed files with 7 additions and 11 deletions
|
@ -92,12 +92,6 @@ web_cache_get_headers (gchar* filename)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
dsc_filename = g_strdup_printf ("%s.dsc", filename);
|
dsc_filename = g_strdup_printf ("%s.dsc", filename);
|
||||||
if (g_access (dsc_filename, R_OK) != 0)
|
|
||||||
{
|
|
||||||
g_free (dsc_filename);
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
headers = g_hash_table_new_full (g_str_hash, g_str_equal,
|
headers = g_hash_table_new_full (g_str_hash, g_str_equal,
|
||||||
(GDestroyNotify)g_free,
|
(GDestroyNotify)g_free,
|
||||||
(GDestroyNotify)g_free);
|
(GDestroyNotify)g_free);
|
||||||
|
@ -107,10 +101,12 @@ web_cache_get_headers (gchar* filename)
|
||||||
gchar line[128];
|
gchar line[128];
|
||||||
while (fgets (line, 128, file))
|
while (fgets (line, 128, file))
|
||||||
{
|
{
|
||||||
|
gchar** data;
|
||||||
|
|
||||||
if (line == NULL)
|
if (line == NULL)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
g_strchomp (line);
|
g_strchomp (line);
|
||||||
gchar** data;
|
|
||||||
data = g_strsplit (line, ":", 2);
|
data = g_strsplit (line, ":", 2);
|
||||||
if (data[0] && data[1])
|
if (data[0] && data[1])
|
||||||
g_hash_table_insert (headers, g_strdup (data[0]),
|
g_hash_table_insert (headers, g_strdup (data[0]),
|
||||||
|
@ -118,13 +114,13 @@ web_cache_get_headers (gchar* filename)
|
||||||
g_strfreev (data);
|
g_strfreev (data);
|
||||||
}
|
}
|
||||||
fclose (file);
|
fclose (file);
|
||||||
}
|
|
||||||
else
|
|
||||||
g_hash_table_destroy (headers);
|
|
||||||
|
|
||||||
g_free (dsc_filename);
|
g_free (dsc_filename);
|
||||||
return headers;
|
return headers;
|
||||||
}
|
}
|
||||||
|
g_hash_table_destroy (headers);
|
||||||
|
g_free (dsc_filename);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
web_cache_tmp_prepare (gchar* filename)
|
web_cache_tmp_prepare (gchar* filename)
|
||||||
|
|
Loading…
Reference in a new issue