[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: acl compiler warning
From: |
Bruno Haible |
Subject: |
Re: acl compiler warning |
Date: |
Sat, 7 Jun 2008 20:13:30 +0200 |
User-agent: |
KMail/1.5.4 |
Eric Blake wrote:
> copy-acl.c: In function `qcopy_acl':
> copy-acl.c:42: warning: unused variable `ret'
>
> So I'm committing the following.
Thanks. I find it slightly better to have each #if branch declare its local
variables separately. Committed:
2008-06-07 Bruno Haible <address@hidden>
* lib/copy-acl.c (qcopy_acl): Make the #if branches independent.
* lib/set-mode-acl.c (qset_acl): Choose better local variable names.
--- lib/copy-acl.c.orig 2008-06-07 16:46:52.000000000 +0200
+++ lib/copy-acl.c 2008-06-07 16:46:09.000000000 +0200
@@ -39,13 +39,13 @@
qcopy_acl (const char *src_name, int source_desc, const char *dst_name,
int dest_desc, mode_t mode)
{
- int ret;
-
#if USE_ACL && HAVE_ACL_GET_FILE
/* POSIX 1003.1e (draft 17 -- abandoned) specific version. */
/* Linux, FreeBSD, MacOS X, IRIX, Tru64 */
acl_t acl;
+ int ret;
+
if (HAVE_ACL_GET_FD && source_desc != -1)
acl = acl_get_fd (source_desc);
else
@@ -124,6 +124,7 @@
#elif USE_ACL && defined ACL_NO_TRIVIAL
/* Solaris 10 NFSv4 ACLs. */
+ int ret;
acl_t *aclp = NULL;
ret = (source_desc < 0
? acl_get (src_name, ACL_NO_TRIVIAL, &aclp)
@@ -155,8 +156,7 @@
#else
- ret = qset_acl (dst_name, dest_desc, mode);
- return ret;
+ return qset_acl (dst_name, dest_desc, mode);
#endif
}
--- lib/set-mode-acl.c.orig 2008-06-07 16:46:52.000000000 +0200
+++ lib/set-mode-acl.c 2008-06-07 16:44:58.000000000 +0200
@@ -209,13 +209,13 @@
}
else
{
- int acl_result = (desc < 0 ? acl_set (name, aclp) : facl_set (desc,
aclp));
- int acl_errno = errno;
+ int ret = (desc < 0 ? acl_set (name, aclp) : facl_set (desc, aclp));
+ int saved_errno = errno;
acl_free (aclp);
- if (acl_result == 0 || acl_errno != ENOSYS)
+ if (ret == 0 || saved_errno != ENOSYS)
{
- errno = acl_errno;
- return acl_result;
+ errno = saved_errno;
+ return ret;
}
}