core: Use gs_file_create()
This allows us to drop a chmod() invocation, since the regular file path was the only thing that didn't handle mode.
This commit is contained in:
parent
ed55998f36
commit
acdf1ca4fe
|
|
@ -1211,7 +1211,7 @@ ostree_create_file_from_input (GFile *dest_file,
|
||||||
gboolean ret = FALSE;
|
gboolean ret = FALSE;
|
||||||
const char *dest_path;
|
const char *dest_path;
|
||||||
guint32 uid, gid, mode;
|
guint32 uid, gid, mode;
|
||||||
gs_unref_object GFileOutputStream *out = NULL;
|
gs_unref_object GOutputStream *out = NULL;
|
||||||
|
|
||||||
if (g_cancellable_set_error_if_cancelled (cancellable, error))
|
if (g_cancellable_set_error_if_cancelled (cancellable, error))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
@ -1236,8 +1236,8 @@ ostree_create_file_from_input (GFile *dest_file,
|
||||||
}
|
}
|
||||||
else if (S_ISREG (mode))
|
else if (S_ISREG (mode))
|
||||||
{
|
{
|
||||||
out = g_file_create (dest_file, 0, cancellable, error);
|
if (!gs_file_create (dest_file, mode, &out,
|
||||||
if (!out)
|
cancellable, error))
|
||||||
goto out;
|
goto out;
|
||||||
|
|
||||||
if (input)
|
if (input)
|
||||||
|
|
@ -1296,16 +1296,6 @@ ostree_create_file_from_input (GFile *dest_file,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!S_ISLNK (mode))
|
|
||||||
{
|
|
||||||
if (chmod (dest_path, mode) < 0)
|
|
||||||
{
|
|
||||||
ot_util_set_error_from_errno (error, errno);
|
|
||||||
g_prefix_error (error, "chmod(%u) failed: ", mode);
|
|
||||||
goto out;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (xattrs != NULL)
|
if (xattrs != NULL)
|
||||||
{
|
{
|
||||||
if (!ostree_set_xattrs (dest_file, xattrs, cancellable, error))
|
if (!ostree_set_xattrs (dest_file, xattrs, cancellable, error))
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue