From e570b8ded49430cb5eb8982ed7359405608f0de5 Mon Sep 17 00:00:00 2001 From: nekral-guest Date: Mon, 21 Nov 2011 19:34:22 +0000 Subject: [PATCH] * libmisc/copydir.c: Ignore errors to copy ACLs if the operation is not supported. --- ChangeLog | 5 +++++ libmisc/copydir.c | 19 +++++++++++++------ 2 files changed, 18 insertions(+), 6 deletions(-) diff --git a/ChangeLog b/ChangeLog index 0e1c65e4..b69f9c26 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2011-11-21 Peter Vrabec + + * libmisc/copydir.c: Ignore errors to copy ACLs if the operation + is not supported. + 2011-11-19 Nicolas François * libmisc/root_flag.c, src/gpasswd.c, src/chsh.c: Add splint diff --git a/libmisc/copydir.c b/libmisc/copydir.c index 49bd0786..93f2b4f2 100644 --- a/libmisc/copydir.c +++ b/libmisc/copydir.c @@ -183,6 +183,7 @@ static void error_acl (struct error_context *ctx, const char *fmt, ...) /* ignore the case when destination does not support ACLs * or extended attributes */ if (ENOTSUP == errno) { + errno = 0; return; } @@ -555,7 +556,7 @@ static int copy_dir (const char *src, const char *dst, old_uid, new_uid, old_gid, new_gid) != 0) #ifdef WITH_ACL || ( (perm_copy_file (src, dst, &ctx) != 0) - && (errno != ENOTSUP)) + && (errno != 0)) #else /* !WITH_ACL */ || (chmod (dst, statp->st_mode) != 0) #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 * 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 */ || (copy_tree (src, dst, false, reset_selinux, 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) #ifdef WITH_ACL || ( (perm_copy_file (src, dst, &ctx) != 0) - && (errno != ENOTSUP)) + && (errno != 0)) #else /* !WITH_ACL */ || (chmod (dst, statp->st_mode & 07777) != 0) #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 * 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 */ || (utimes (dst, mt) != 0)) { 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) #ifdef WITH_ACL || ( (perm_copy_fd (src, ifd, dst, ofd, &ctx) != 0) - && (errno != ENOTSUP)) + && (errno != 0)) #else /* !WITH_ACL */ || (fchmod (ofd, statp->st_mode & 07777) != 0) #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 * 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 */ ) { (void) close (ifd);