# HG changeset patch # User Bruno Haible # Date 1212892492 -7200 # Node ID 7215efd0ff4f1baaf0aca5f077e887ddd79875f3 # Parent d688b8e59f3187606ab56ca7dfea9fd51e4a3134 Trivial code simplifications. diff -r d688b8e59f31 -r 7215efd0ff4f ChangeLog --- a/ChangeLog Sat Jun 07 20:11:23 2008 +0200 +++ b/ChangeLog Sun Jun 08 04:34:52 2008 +0200 @@ -1,3 +1,9 @@ +2008-06-07 Bruno Haible + + * lib/set-mode-acl.c (chmod_or_fchmod): Document return value + precisely. + * lib/copy-acl.c (qcopy_acl): Trivial code simplifications. + 2008-06-07 Bruno Haible * lib/copy-acl.c (qcopy_acl): Make the #if branches independent. diff -r d688b8e59f31 -r 7215efd0ff4f lib/copy-acl.c --- a/lib/copy-acl.c Sat Jun 07 20:11:23 2008 +0200 +++ b/lib/copy-acl.c Sun Jun 08 04:34:52 2008 +0200 @@ -66,29 +66,18 @@ { int saved_errno = errno; - if (ACL_NOT_WELL_SUPPORTED (errno)) + if (ACL_NOT_WELL_SUPPORTED (errno) && !acl_access_nontrivial (acl)) { - int nontrivial = acl_access_nontrivial (acl); - acl_free (acl); - - if (!nontrivial) - { - if (chmod_or_fchmod (dst_name, dest_desc, mode) != 0) - saved_errno = errno; - else - return 0; - } - else - chmod_or_fchmod (dst_name, dest_desc, mode); + return chmod_or_fchmod (dst_name, dest_desc, mode); } else { acl_free (acl); chmod_or_fchmod (dst_name, dest_desc, mode); + errno = saved_errno; + return -1; } - errno = saved_errno; - return -1; } else acl_free (acl); diff -r d688b8e59f31 -r 7215efd0ff4f lib/set-mode-acl.c --- a/lib/set-mode-acl.c Sat Jun 07 20:11:23 2008 +0200 +++ b/lib/set-mode-acl.c Sun Jun 08 04:34:52 2008 +0200 @@ -26,7 +26,8 @@ /* If DESC is a valid file descriptor use fchmod to change the file's mode to MODE on systems that have fchown. On systems that don't have fchown and if DESC is invalid, use chown on - NAME instead. */ + NAME instead. + Return 0 if successful. Return -1 and set errno upon failure. */ int chmod_or_fchmod (const char *name, int desc, mode_t mode)