changeset 10176:43bafd6ea0d8

Trivial code simplifications.
author Bruno Haible <bruno@clisp.org>
date Sun, 08 Jun 2008 13:29:35 +0200
parents ed86dd8c386e
children caed32fb1892
files ChangeLog lib/set-mode-acl.c
diffstat 2 files changed, 14 insertions(+), 15 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Sun Jun 08 13:19:49 2008 +0200
+++ b/ChangeLog	Sun Jun 08 13:29:35 2008 +0200
@@ -1,3 +1,7 @@
+2008-06-08  Bruno Haible  <bruno@clisp.org>
+
+	* lib/set-mode-acl.c (qset_acl): Trivial code simplifications.
+
 2008-06-08  Jim Meyering  <meyering@redhat.com>
 
 	* modules/acl (Maintainer): Add Bruno Haible.
--- a/lib/set-mode-acl.c	Sun Jun 08 13:19:49 2008 +0200
+++ b/lib/set-mode-acl.c	Sun Jun 08 13:29:35 2008 +0200
@@ -115,14 +115,12 @@
       acl_free (acl);
 
       if (ACL_NOT_WELL_SUPPORTED (errno))
+	return chmod_or_fchmod (name, desc, mode);
+      else
 	{
-	  if (chmod_or_fchmod (name, desc, mode) != 0)
-	    saved_errno = errno;
-	  else
-	    return 0;
+	  errno = saved_errno;
+	  return -1;
 	}
-      errno = saved_errno;
-      return -1;
     }
   else
     acl_free (acl);
@@ -134,9 +132,7 @@
     {
       /* 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 chmod_or_fchmod (name, desc, mode);
     }
   return 0;
 
@@ -186,19 +182,18 @@
 	      acl_free (acl);
 
 	      if (ACL_NOT_WELL_SUPPORTED (saved_errno))
+		return chmod_or_fchmod (name, desc, mode);
+	      else
 		{
-		  if (chmod_or_fchmod (name, desc, mode) != 0)
-		    saved_errno = errno;
-		  else
-		    return 0;
+		  errno = saved_errno;
+		  return -1;
 		}
-	      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