From 57db74386746703bdfad73c02e5afcf36a59d80e Mon Sep 17 00:00:00 2001 From: Kern Sibbald Date: Fri, 7 Jan 2005 15:18:35 +0000 Subject: [PATCH] Second tweak to acl.c git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@1792 91ce42f0-d328-0410-95d8-f526ca767f89 --- bacula/src/filed/acl.c | 37 +++++++++++++++++++------------------ 1 file changed, 19 insertions(+), 18 deletions(-) diff --git a/bacula/src/filed/acl.c b/bacula/src/filed/acl.c index 0617a0de1a..6cd35e7d79 100644 --- a/bacula/src/filed/acl.c +++ b/bacula/src/filed/acl.c @@ -42,7 +42,10 @@ memory leaks if you forget to free. #include "bacula.h" #include "filed.h" - +/* So we can free system allocated memory */ +#undef free +#undef malloc +#define malloc &* dont use malloc in this routine #else /* @@ -65,7 +68,6 @@ memory leaks if you forget to free. #define POOLMEM char #define bstrdup strdup -#define actuallyfree(x) free(x) int aclls(char *fname); int aclcp(char *src, char *dst); @@ -100,16 +102,16 @@ int bacl_set(char *fname, int acltype, char *acltext) #include -POOLMEM *bacl_get(char *fname, int acltype) +bool bacl_get(JCR *jcr, char *fname, int acltype) { - char *tmp; - POOLMEM *acltext = NULL; + char *acl_text; - if ((tmp = acl_get(fname)) != NULL) { - acltext = bstrdup(tmp); - actuallyfree(tmp); + if ((acl_text = acl_get(fname)) != NULL) { + pm_strcpy(jcr->acl_text, acl_text); + free(acl_text); + return true; } - return acltext; + return false; } int bacl_set(char *fname, int acltype, char *acltext) @@ -148,27 +150,26 @@ int bacl_set(char *fname, int acltype, char *acltext) #endif #endif -POOLMEM *bacl_get(char *fname, int acltype) +bool bacl_get(JCR *jcr, char *fname, int acltype) { acl_t acl; int ostype; - char *tmp; - POOLMEM *acltext = NULL; + char *acl_text; ostype = (acltype & BACL_TYPE_DEFAULT) ? ACL_TYPE_DEFAULT : ACL_TYPE_ACCESS; acl = acl_get_file(fname, ostype); if (acl) { - if ((tmp = acl_to_text(acl, NULL)) != NULL) { - acltext = get_pool_memory(PM_MESSAGE); - pm_strcpy(acltext, tmp); - acl_free(tmp); + if ((acl_text = acl_to_text(acl, NULL)) != NULL) { + pm_strcpy(jcr->acl_text, acl_text); + acl_free(acl_text); + return true; } - acl_free(acl); + acl_free(acl_text); } /***** Do we really want to silently ignore errors from acl_get_file and acl_to_text? *****/ - return acltext; + return false; } int bacl_set(char *fname, int acltype, char *acltext) -- 2.39.5