main, copyup: avoid a chown if it is not needed

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
This commit is contained in:
Giuseppe Scrivano 2019-07-24 16:04:38 +02:00
parent 74fa25112a
commit 0749dd7fb8
No known key found for this signature in database
GPG Key ID: E4730F97F60286ED

9
main.c
View File

@ -2383,9 +2383,12 @@ copyup (struct ovl_data *lo, struct ovl_node *node)
if (dfd < 0)
goto exit;
ret = fchown (dfd, st.st_uid, st.st_gid);
if (ret < 0)
goto exit;
if (st.st_uid != lo->uid || st.st_gid != lo->gid)
{
ret = fchown (dfd, st.st_uid, st.st_gid);
if (ret < 0)
goto exit;
}
buf = malloc (buf_size);
if (buf == NULL)