Skip to content

Commit

Permalink
utils: Explicitly set permissions on installed metadata files
Browse files Browse the repository at this point in the history
Resolves: #681
  • Loading branch information
ximion committed Dec 8, 2024
1 parent e482743 commit c6903ab
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/as-utils.c
Original file line number Diff line number Diff line change
Expand Up @@ -2434,6 +2434,7 @@ as_utils_install_metadata_file_internal (const gchar *filename,
g_autofree gchar *path_parent = NULL;
g_autoptr(GFile) file_dest = NULL;
g_autoptr(GFile) file_src = NULL;
g_autoptr(GError) tmp_error = NULL;

/* create directory structure */
path_parent = g_strdup_printf ("%s%s", destdir, dir);
Expand Down Expand Up @@ -2472,6 +2473,17 @@ as_utils_install_metadata_file_internal (const gchar *filename,
if (!g_file_copy (file_src, file_dest, G_FILE_COPY_OVERWRITE, NULL, NULL, NULL, error))
return FALSE;

/* explicitly set permissions on the copied file */
if (!g_file_set_attribute_uint32 (file_dest,
G_FILE_ATTRIBUTE_UNIX_MODE,
0644,
G_FILE_QUERY_INFO_NONE,
NULL,
&tmp_error)) {
g_debug ("Error setting file permissions: %s", tmp_error->message);
g_clear_error (&tmp_error);
}

/* update the origin for XML files */
if (origin != NULL && !is_yaml) {
g_autoptr(AsMetadata) mdata = as_metadata_new ();
Expand Down

0 comments on commit c6903ab

Please sign in to comment.