* libmisc/copydir.c: Ignore errors to copy ACLs if the operation

is not supported.
This commit is contained in:
nekral-guest 2011-11-21 19:34:22 +00:00
parent bd4a6c9966
commit e570b8ded4
2 changed files with 18 additions and 6 deletions

View File

@ -1,3 +1,8 @@
2011-11-21 Peter Vrabec <pvrabec@redhat.com>
* libmisc/copydir.c: Ignore errors to copy ACLs if the operation
is not supported.
2011-11-19 Nicolas François <nicolas.francois@centraliens.net> 2011-11-19 Nicolas François <nicolas.francois@centraliens.net>
* libmisc/root_flag.c, src/gpasswd.c, src/chsh.c: Add splint * libmisc/root_flag.c, src/gpasswd.c, src/chsh.c: Add splint

View File

@ -183,6 +183,7 @@ static void error_acl (struct error_context *ctx, const char *fmt, ...)
/* ignore the case when destination does not support ACLs /* ignore the case when destination does not support ACLs
* or extended attributes */ * or extended attributes */
if (ENOTSUP == errno) { if (ENOTSUP == errno) {
errno = 0;
return; return;
} }
@ -555,7 +556,7 @@ static int copy_dir (const char *src, const char *dst,
old_uid, new_uid, old_gid, new_gid) != 0) old_uid, new_uid, old_gid, new_gid) != 0)
#ifdef WITH_ACL #ifdef WITH_ACL
|| ( (perm_copy_file (src, dst, &ctx) != 0) || ( (perm_copy_file (src, dst, &ctx) != 0)
&& (errno != ENOTSUP)) && (errno != 0))
#else /* !WITH_ACL */ #else /* !WITH_ACL */
|| (chmod (dst, statp->st_mode) != 0) || (chmod (dst, statp->st_mode) != 0)
#endif /* !WITH_ACL */ #endif /* !WITH_ACL */
@ -567,7 +568,9 @@ static int copy_dir (const char *src, const char *dst,
* file systems with and without ACL support needs some * file systems with and without ACL support needs some
* additional logic so that no unexpected permissions result. * additional logic so that no unexpected permissions result.
*/ */
|| (!reset_selinux && (attr_copy_file (src, dst, NULL, &ctx) != 0)) || ( !reset_selinux
&& (attr_copy_file (src, dst, NULL, &ctx) != 0)
&& (errno != 0))
#endif /* WITH_ATTR */ #endif /* WITH_ATTR */
|| (copy_tree (src, dst, false, reset_selinux, || (copy_tree (src, dst, false, reset_selinux,
old_uid, new_uid, old_gid, new_gid) != 0) old_uid, new_uid, old_gid, new_gid) != 0)
@ -754,7 +757,7 @@ static int copy_special (const char *src, const char *dst,
old_uid, new_uid, old_gid, new_gid) != 0) old_uid, new_uid, old_gid, new_gid) != 0)
#ifdef WITH_ACL #ifdef WITH_ACL
|| ( (perm_copy_file (src, dst, &ctx) != 0) || ( (perm_copy_file (src, dst, &ctx) != 0)
&& (errno != ENOTSUP)) && (errno != 0))
#else /* !WITH_ACL */ #else /* !WITH_ACL */
|| (chmod (dst, statp->st_mode & 07777) != 0) || (chmod (dst, statp->st_mode & 07777) != 0)
#endif /* !WITH_ACL */ #endif /* !WITH_ACL */
@ -766,7 +769,9 @@ static int copy_special (const char *src, const char *dst,
* file systems with and without ACL support needs some * file systems with and without ACL support needs some
* additional logic so that no unexpected permissions result. * additional logic so that no unexpected permissions result.
*/ */
|| (!reset_selinux && (attr_copy_file (src, dst, NULL, &ctx) != 0)) || ( !reset_selinux
&& (attr_copy_file (src, dst, NULL, &ctx) != 0)
&& (errno != 0))
#endif /* WITH_ATTR */ #endif /* WITH_ATTR */
|| (utimes (dst, mt) != 0)) { || (utimes (dst, mt) != 0)) {
err = -1; err = -1;
@ -812,7 +817,7 @@ static int copy_file (const char *src, const char *dst,
old_uid, new_uid, old_gid, new_gid) != 0) old_uid, new_uid, old_gid, new_gid) != 0)
#ifdef WITH_ACL #ifdef WITH_ACL
|| ( (perm_copy_fd (src, ifd, dst, ofd, &ctx) != 0) || ( (perm_copy_fd (src, ifd, dst, ofd, &ctx) != 0)
&& (errno != ENOTSUP)) && (errno != 0))
#else /* !WITH_ACL */ #else /* !WITH_ACL */
|| (fchmod (ofd, statp->st_mode & 07777) != 0) || (fchmod (ofd, statp->st_mode & 07777) != 0)
#endif /* !WITH_ACL */ #endif /* !WITH_ACL */
@ -824,7 +829,9 @@ static int copy_file (const char *src, const char *dst,
* file systems with and without ACL support needs some * file systems with and without ACL support needs some
* additional logic so that no unexpected permissions result. * additional logic so that no unexpected permissions result.
*/ */
|| (!reset_selinux && (attr_copy_fd (src, ifd, dst, ofd, NULL, &ctx) != 0)) || ( !reset_selinux
&& (attr_copy_fd (src, ifd, dst, ofd, NULL, &ctx) != 0)
&& (errno != 0))
#endif /* WITH_ATTR */ #endif /* WITH_ATTR */
) { ) {
(void) close (ifd); (void) close (ifd);