mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-23 02:01:12 +00:00
registrybinary: registry file mode via GST_REGISTRY_MODE
In an embedded system where all services run as seperate users it is useful to have the gstreamer registry readable by all so it can be re-used, in similar manner as a host system where one user have seperate applications running but all share same registry. To make this possible introducing GST_REGISTRY_MODE for adjusting the changing mode of the registry binary when finishing up with the temporary file (which has restricted access). Fixes: #692 Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/825>
This commit is contained in:
parent
0596da1966
commit
69b3b1d6bf
1 changed files with 17 additions and 0 deletions
|
@ -252,6 +252,7 @@ static gboolean
|
|||
gst_registry_binary_cache_finish (BinaryRegistryCache * cache, gboolean success)
|
||||
{
|
||||
gint fclose_ret;
|
||||
const gchar *registry_mode;
|
||||
|
||||
if (success) {
|
||||
/* flush the file and make sure the OS's buffer has been written to disk */
|
||||
|
@ -292,6 +293,22 @@ gst_registry_binary_cache_finish (BinaryRegistryCache * cache, gboolean success)
|
|||
if (g_rename (cache->tmp_location, cache->location) < 0)
|
||||
goto rename_failed;
|
||||
|
||||
/* Change mode of registry if set in environment */
|
||||
registry_mode = g_getenv ("GST_REGISTRY_MODE");
|
||||
if (registry_mode) {
|
||||
gchar *endptr;
|
||||
gint64 mode;
|
||||
|
||||
/* Expect numeric mode as one to four octal digits */
|
||||
mode = g_ascii_strtoll (registry_mode, &endptr, 8);
|
||||
if (mode > G_MAXINT || *endptr != '\0')
|
||||
GST_ERROR ("GST_REGISTRY_MODE not an integer value");
|
||||
else if (g_chmod (cache->location, mode) < 0)
|
||||
GST_ERROR ("g_chmod failed: %s", g_strerror (errno));
|
||||
else
|
||||
GST_INFO ("Changed mode of registry cache to %s", registry_mode);
|
||||
}
|
||||
|
||||
g_free (cache->tmp_location);
|
||||
g_slice_free (BinaryRegistryCache, cache);
|
||||
GST_INFO ("Wrote binary registry cache");
|
||||
|
|
Loading…
Reference in a new issue