gfile: Don’t copy files as private if using default permissions

If a copy operation is started with `G_FILE_COPY_TARGET_DEFAULT_PERMS`,
don’t create the destination file as private. Instead, create it with
the process’ current umask (i.e. ‘default permissions’).

This is a partial re-work of commit d8f8f4d6, with
input from Ondrej Holy.

Signed-off-by: Philip Withnall <>

Fixes: #174
11 jobs for backport-1134-file-copy-fix-glib-2-62 in 34 minutes and 47 seconds (queued for 5 seconds)