bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: acl: trivial simplification


From: Bruno Haible
Subject: Re: acl: trivial simplification
Date: Sun, 8 Jun 2008 13:29:17 +0200
User-agent: KMail/1.5.4

> exploit the fact
> that chmod_or_fchmod has already the right return value convention.

More simplifications of the same kind:


2008-06-08  Bruno Haible  <address@hidden>

        * lib/set-mode-acl.c (qset_acl): Trivial code simplifications.

*** lib/set-mode-acl.c.orig     2008-06-08 13:25:40.000000000 +0200
--- lib/set-mode-acl.c  2008-06-08 13:25:14.000000000 +0200
***************
*** 115,128 ****
        acl_free (acl);
  
        if (ACL_NOT_WELL_SUPPORTED (errno))
        {
!         if (chmod_or_fchmod (name, desc, mode) != 0)
!           saved_errno = errno;
!         else
!           return 0;
        }
-       errno = saved_errno;
-       return -1;
      }
    else
      acl_free (acl);
--- 115,126 ----
        acl_free (acl);
  
        if (ACL_NOT_WELL_SUPPORTED (errno))
+       return chmod_or_fchmod (name, desc, mode);
+       else
        {
!         errno = saved_errno;
!         return -1;
        }
      }
    else
      acl_free (acl);
***************
*** 134,142 ****
      {
        /* We did not call chmod so far, so the special bits have not yet
           been set.  */
! 
!       if (chmod_or_fchmod (name, desc, mode))
!       return -1;
      }
    return 0;
  
--- 132,138 ----
      {
        /* We did not call chmod so far, so the special bits have not yet
           been set.  */
!       return chmod_or_fchmod (name, desc, mode);
      }
    return 0;
  
***************
*** 186,204 ****
              acl_free (acl);
  
              if (ACL_NOT_WELL_SUPPORTED (saved_errno))
                {
!                 if (chmod_or_fchmod (name, desc, mode) != 0)
!                   saved_errno = errno;
!                 else
!                   return 0;
                }
-             errno = saved_errno;
-             return -1;
            }
          acl_free (acl);
        }
      }
  
    return chmod_or_fchmod (name, desc, mode);
  #  endif
  
--- 182,199 ----
              acl_free (acl);
  
              if (ACL_NOT_WELL_SUPPORTED (saved_errno))
+               return chmod_or_fchmod (name, desc, mode);
+             else
                {
!                 errno = saved_errno;
!                 return -1;
                }
            }
          acl_free (acl);
        }
      }
  
+   /* Since !MODE_INSIDE_ACL, we have to call chmod explicitly.  */
    return chmod_or_fchmod (name, desc, mode);
  #  endif
  





reply via email to

[Prev in Thread] Current Thread [Next in Thread]