gst/gstregistryxml.c: Fix silly bug that prevented us from creating ~/.gstreamer-0.10 and writing the registry in one...

Original commit message from CVS:
* gst/gstregistryxml.c: (gst_registry_xml_write_cache):
Fix silly bug that prevented us from creating
~/.gstreamer-0.10 and writing the registry in one
go (the first call to g_mkstemp() would overwrite the
placeholder in the template string, so the second call
to g_mkstemp() after creating the missing directory
would then error out with 'invalid argument').
This commit is contained in:
Tim-Philipp Müller 2006-06-13 13:30:46 +00:00
parent 0b680571ab
commit d50e3a7951
2 changed files with 19 additions and 4 deletions

View file

@ -1,3 +1,13 @@
2006-06-13 Tim-Philipp Müller <tim at centricular dot net>
* gst/gstregistryxml.c: (gst_registry_xml_write_cache):
Fix silly bug that prevented us from creating
~/.gstreamer-0.10 and writing the registry in one
go (the first call to g_mkstemp() would overwrite the
placeholder in the template string, so the second call
to g_mkstemp() after creating the missing directory
would then error out with 'invalid argument').
2006-06-13 Edward Hervey <edward@fluendo.com>
* gst/gst.c: (init_post):

View file

@ -840,11 +840,16 @@ gst_registry_xml_write_cache (GstRegistry * registry, const char *location)
g_mkdir_with_parents (dir, 0777);
g_free (dir);
registry->cache_file = g_mkstemp (tmp_location);
}
if (registry->cache_file == -1) {
/* the previous g_mkstemp call overwrote the XXXXXX placeholder ... */
g_free (tmp_location);
return FALSE;
tmp_location = g_strconcat (location, ".tmpXXXXXX", NULL);
registry->cache_file = g_mkstemp (tmp_location);
if (registry->cache_file == -1) {
GST_DEBUG ("g_mkstemp() failed: %s", g_strerror (errno));
g_free (tmp_location);
return FALSE;
}
}
if (!gst_registry_save (registry, "<?xml version=\"1.0\"?>\n"))