[Spice-devel] Too strict permission in agent (was: Factor out function to create file)

Frediano Ziglio fziglio at redhat.com
Wed Jan 16 10:09:47 UTC 2019


> 
> Make easier to test file creation
> 
> Signed-off-by: Frediano Ziglio <fziglio at redhat.com>
> ---
>  src/vdagent/file-xfers.c | 88 ++++++++++++++++++++++++----------------
>  src/vdagent/file-xfers.h |  1 +
>  2 files changed, 53 insertions(+), 36 deletions(-)
> 
> diff --git a/src/vdagent/file-xfers.c b/src/vdagent/file-xfers.c
> index 77029e7..941524a 100644
> --- a/src/vdagent/file-xfers.c
> +++ b/src/vdagent/file-xfers.c
> @@ -178,13 +178,58 @@ static uint64_t get_free_space_available(const char
> *path)
>      return stat.f_bsize * stat.f_bavail;
>  }
>  
> +int
> +vdagent_file_xfers_create_file(const char *save_dir, char **file_name_p)
> +{
> +    char *file_path = NULL;
> +    char *dir = NULL;
> +    char *path = NULL;
> +    int file_fd = -1;
> +    int i;
> +    struct stat st;
> +
> +    file_path = g_build_filename(save_dir, *file_name_p, NULL);
> +    dir = g_path_get_dirname(file_path);
> +    if (g_mkdir_with_parents(dir, S_IRWXU) == -1) {

Not a regression of this patch, but, isn't these permissions too strict?
All new subdirectories are created with 700 permissions.

Frediano


More information about the Spice-devel mailing list