From: Marco van Wieringen Date: Thu, 15 Sep 2011 20:46:54 +0000 (+0200) Subject: Change error checking from os specific to generic. X-Git-Tag: Release-7.0.0~574 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=0f6338628f7c52c6532e9129d05104b969843679;p=bacula%2Fbacula Change error checking from os specific to generic. As ENOSYS, ENOTSUP and EOPNOTSUPP are POSIX errors defined on all platforms we no longer check for an OS specific error but allow any of the 3 errors to give us the feedback that acls are not supported. This is cleaner anyway. --- diff --git a/bacula/src/filed/acl.c b/bacula/src/filed/acl.c index ed2f5766fc..f80b2b53a5 100644 --- a/bacula/src/filed/acl.c +++ b/bacula/src/filed/acl.c @@ -701,8 +701,9 @@ static bacl_exit_code generic_get_acl_from_os(JCR *jcr, bacl_type acltype) * Handle errors gracefully. */ switch (errno) { -#if defined(BACL_ENOTSUP) - case BACL_ENOTSUP: + case ENOSYS: + case ENOTSUP: + case EOPNOTSUPP: /** * If the filesystem reports it doesn't support ACLs we clear the * BACL_FLAG_SAVE_NATIVE flag so we skip ACL saves on all other files @@ -711,7 +712,6 @@ static bacl_exit_code generic_get_acl_from_os(JCR *jcr, bacl_type acltype) */ jcr->acl_data->flags &= ~BACL_FLAG_SAVE_NATIVE; goto bail_out; -#endif case ENOENT: goto bail_out; default: @@ -755,12 +755,12 @@ static bacl_exit_code generic_set_acl_on_os(JCR *jcr, bacl_type acltype) switch (errno) { case ENOENT: return bacl_exit_ok; -#if defined(BACL_ENOTSUP) - case BACL_ENOTSUP: + case ENOSYS: + case ENOTSUP: + case EOPNOTSUPP: Mmsg1(jcr->errmsg, _("acl_delete_def_file error on file \"%s\": filesystem doesn't support ACLs\n"), jcr->last_fname); return bacl_exit_ok; -#endif default: Mmsg2(jcr->errmsg, _("acl_delete_def_file error on file \"%s\": ERR=%s\n"), jcr->last_fname, be.bstrerror()); @@ -803,15 +803,15 @@ static bacl_exit_code generic_set_acl_on_os(JCR *jcr, bacl_type acltype) case ENOENT: acl_free(acl); return bacl_exit_ok; -#if defined(BACL_ENOTSUP) - case BACL_ENOTSUP: + case ENOSYS: + case ENOTSUP: + case EOPNOTSUPP: Mmsg1(jcr->errmsg, _("acl_set_file error on file \"%s\": filesystem doesn't support ACLs\n"), jcr->last_fname); Dmsg2(100, "acl_set_file error acl=%s file=%s filesystem doesn't support ACLs\n", jcr->acl_data->content, jcr->last_fname); acl_free(acl); return bacl_exit_ok; -#endif default: Mmsg2(jcr->errmsg, _("acl_set_file error on file \"%s\": ERR=%s\n"), jcr->last_fname, be.bstrerror()); @@ -1262,8 +1262,9 @@ static bacl_exit_code hpux_build_acl_streams(JCR *jcr, FF_PKT *ff_pkt) if ((n = getacl(jcr->last_fname, 0, acls)) < 0) { switch (errno) { -#if defined(BACL_ENOTSUP) - case BACL_ENOTSUP: + case ENOSYS: + case ENOTSUP: + case EOPNOTSUPP: /** * Not supported, just pretend there is nothing to see * @@ -1276,7 +1277,6 @@ static bacl_exit_code hpux_build_acl_streams(JCR *jcr, FF_PKT *ff_pkt) pm_strcpy(jcr->acl_data->content, ""); jcr->acl_data->content_length = 0; return bacl_exit_ok; -#endif case ENOENT: pm_strcpy(jcr->acl_data->content, ""); jcr->acl_data->content_length = 0; diff --git a/bacula/src/filed/acl.h b/bacula/src/filed/acl.h index 93615f6411..d8f1f09ef8 100644 --- a/bacula/src/filed/acl.h +++ b/bacula/src/filed/acl.h @@ -58,18 +58,6 @@ typedef enum { #define ACL_TYPE_NONE 0x0 #endif -#if defined(HAVE_FREEBSD_OS) -#define BACL_ENOTSUP EOPNOTSUPP -#elif defined(HAVE_DARWIN_OS) -#define BACL_ENOTSUP EOPNOTSUPP -#elif defined(HAVE_HPUX_OS) -#define BACL_ENOTSUP EOPNOTSUPP -#elif defined(HAVE_IRIX_OS) -#define BACL_ENOTSUP ENOSYS -#elif defined(HAVE_LINUX_OS) -#define BACL_ENOTSUP ENOTSUP -#endif - #define BACL_FLAG_SAVE_NATIVE 0x01 #define BACL_FLAG_SAVE_AFS 0x02