1 From debbe4f7b591b3f35d0ed65c17fa81b196b2eb2d Mon Sep 17 00:00:00 2001
2 From: Mike Frysinger <vapier@gentoo.org>
3 Date: Tue, 12 Aug 2014 08:37:25 -0400
4 Subject: [PATCH] add __acl_ prefixes to internal symbols
6 When static linking libacl, people sometimes run into symbol collisions
7 because their own code defines symbols like "quote". So for acl internal
8 symbols, use an __acl_ prefix.
10 [Rahul Bedarkar: backported from upstream
11 http://git.savannah.gnu.org/cgit/acl.git/commit/?id=a2c4d71c2e84419a49db503ed59de4d3d1dca7dd ]
12 Signed-off-by: Rahul Bedarkar <rahul.bedarkar@imgtec.com>
14 exports | 12 ++----------
15 getfacl/getfacl.c | 4 ++--
16 include/misc.h | 8 ++++----
17 libacl/__acl_to_any_text.c | 4 ++--
18 libacl/acl_from_text.c | 4 ++--
19 libmisc/high_water_alloc.c | 2 +-
20 libmisc/next_line.c | 6 +++---
21 libmisc/quote.c | 4 ++--
22 libmisc/unquote.c | 2 +-
23 setfacl/parse.c | 10 +++++-----
24 setfacl/setfacl.c | 4 ++--
25 11 files changed, 26 insertions(+), 34 deletions(-)
27 diff --git a/exports b/exports
28 index 7d8e69e..bf15d84 100644
31 @@ -59,22 +59,14 @@ ACL_1.0 {
35 - # Library internal stuff
36 + # Library internal stuff
42 - __acl_reorder_entry_obj_p;
43 - __acl_reorder_obj_p;
45 - __acl_create_entry_obj;
56 diff --git a/getfacl/getfacl.c b/getfacl/getfacl.c
57 index f8eaf25..af9e225 100644
58 --- a/getfacl/getfacl.c
59 +++ b/getfacl/getfacl.c
60 @@ -90,7 +90,7 @@ int opt_numeric; /* don't convert id's to symbolic names */
62 static const char *xquote(const char *str, const char *quote_chars)
64 - const char *q = quote(str, quote_chars);
65 + const char *q = __acl_quote(str, quote_chars);
67 fprintf(stderr, "%s: %s\n", progname, strerror(errno));
69 @@ -718,7 +718,7 @@ int main(int argc, char *argv[])
72 strcmp(argv[optind], "-") == 0) {
73 - while ((line = next_line(stdin)) != NULL) {
74 + while ((line = __acl_next_line(stdin)) != NULL) {
78 diff --git a/include/misc.h b/include/misc.h
79 index 0c5fdcc..c25accf 100644
83 along with this program. If not, see <http://www.gnu.org/licenses/>.
86 -extern int high_water_alloc(void **buf, size_t *bufsize, size_t newsize);
87 +extern int __acl_high_water_alloc(void **buf, size_t *bufsize, size_t newsize);
89 -extern const char *quote(const char *str, const char *quote_chars);
90 -extern char *unquote(char *str);
91 +extern const char *__acl_quote(const char *str, const char *quote_chars);
92 +extern char *__acl_unquote(char *str);
94 -extern char *next_line(FILE *file);
95 +extern char *__acl_next_line(FILE *file);
96 diff --git a/libacl/__acl_to_any_text.c b/libacl/__acl_to_any_text.c
97 index a4f9c34..19f1ccc 100644
98 --- a/libacl/__acl_to_any_text.c
99 +++ b/libacl/__acl_to_any_text.c
100 @@ -159,7 +159,7 @@ acl_entry_to_any_str(const acl_entry_t entry_d, char *text_p, ssize_t size,
101 if (options & TEXT_NUMERIC_IDS)
104 - str = quote(user_name(
105 + str = __acl_quote(user_name(
106 entry_obj_p->eid.qid), ":, \t\n\r");
108 strncpy(text_p, str, size);
109 @@ -182,7 +182,7 @@ acl_entry_to_any_str(const acl_entry_t entry_d, char *text_p, ssize_t size,
110 if (options & TEXT_NUMERIC_IDS)
113 - str = quote(group_name(
114 + str = __acl_quote(group_name(
115 entry_obj_p->eid.qid), ":, \t\n\r");
117 strncpy(text_p, str, size);
118 diff --git a/libacl/acl_from_text.c b/libacl/acl_from_text.c
119 index 1e05322..f6165be 100644
120 --- a/libacl/acl_from_text.c
121 +++ b/libacl/acl_from_text.c
122 @@ -206,7 +206,7 @@ parse_acl_entry(const char **text_p, acl_t *acl_p)
123 str = get_token(text_p);
125 entry_obj.etag = ACL_USER;
126 - error = get_uid(unquote(str),
127 + error = get_uid(__acl_unquote(str),
131 @@ -225,7 +225,7 @@ parse_acl_entry(const char **text_p, acl_t *acl_p)
132 str = get_token(text_p);
134 entry_obj.etag = ACL_GROUP;
135 - error = get_gid(unquote(str),
136 + error = get_gid(__acl_unquote(str),
140 diff --git a/libmisc/high_water_alloc.c b/libmisc/high_water_alloc.c
141 index c127dc1..951f4bb 100644
142 --- a/libmisc/high_water_alloc.c
143 +++ b/libmisc/high_water_alloc.c
148 -int high_water_alloc(void **buf, size_t *bufsize, size_t newsize)
149 +int __acl_high_water_alloc(void **buf, size_t *bufsize, size_t newsize)
151 #define CHUNK_SIZE 256
153 diff --git a/libmisc/next_line.c b/libmisc/next_line.c
154 index 0566d7a..126a364 100644
155 --- a/libmisc/next_line.c
156 +++ b/libmisc/next_line.c
159 #define LINE_SIZE getpagesize()
161 -char *next_line(FILE *file)
162 +char *__acl_next_line(FILE *file)
165 static size_t line_size;
166 @@ -31,7 +31,7 @@ char *next_line(FILE *file)
170 - if (high_water_alloc((void **)&line, &line_size, LINE_SIZE))
171 + if (__acl_high_water_alloc((void **)&line, &line_size, LINE_SIZE))
175 @@ -47,7 +47,7 @@ char *next_line(FILE *file)
179 - if (high_water_alloc((void **)&line, &line_size,
180 + if (__acl_high_water_alloc((void **)&line, &line_size,
183 c = strrchr(line, '\0');
184 diff --git a/libmisc/quote.c b/libmisc/quote.c
185 index bf8f9eb..a28800c 100644
186 --- a/libmisc/quote.c
187 +++ b/libmisc/quote.c
192 -const char *quote(const char *str, const char *quote_chars)
193 +const char *__acl_quote(const char *str, const char *quote_chars)
195 static char *quoted_str;
196 static size_t quoted_str_len;
197 @@ -40,7 +40,7 @@ const char *quote(const char *str, const char *quote_chars)
201 - if (high_water_alloc((void **)"ed_str, "ed_str_len,
202 + if (__acl_high_water_alloc((void **)"ed_str, "ed_str_len,
203 (s - (unsigned char *)str) + nonpr * 3 + 1))
205 for (s = (unsigned char *)str, q = quoted_str; *s != '\0'; s++) {
206 diff --git a/libmisc/unquote.c b/libmisc/unquote.c
207 index bffebf9..4f4ce7c 100644
208 --- a/libmisc/unquote.c
209 +++ b/libmisc/unquote.c
214 -char *unquote(char *str)
215 +char *__acl_unquote(char *str)
217 unsigned char *s, *t;
219 diff --git a/setfacl/parse.c b/setfacl/parse.c
220 index e7e6add..7433459 100644
221 --- a/setfacl/parse.c
222 +++ b/setfacl/parse.c
223 @@ -226,7 +226,7 @@ user_entry:
224 str = get_token(text_p);
226 cmd->c_tag = ACL_USER;
227 - error = get_uid(unquote(str), &cmd->c_id);
228 + error = get_uid(__acl_unquote(str), &cmd->c_id);
232 @@ -245,7 +245,7 @@ user_entry:
233 str = get_token(text_p);
235 cmd->c_tag = ACL_GROUP;
236 - error = get_gid(unquote(str), &cmd->c_id);
237 + error = get_gid(__acl_unquote(str), &cmd->c_id);
241 @@ -466,7 +466,7 @@ read_acl_comments(
242 if (strncmp(cp, "file:", 5) == 0) {
246 + cp = __acl_unquote(cp);
250 @@ -483,7 +483,7 @@ read_acl_comments(
252 if (*uid_p != ACL_UNDEFINED_ID)
254 - if (get_uid(unquote(cp), uid_p) != 0)
255 + if (get_uid(__acl_unquote(cp), uid_p) != 0)
258 } else if (strncmp(cp, "group:", 6) == 0) {
259 @@ -493,7 +493,7 @@ read_acl_comments(
261 if (*gid_p != ACL_UNDEFINED_ID)
263 - if (get_gid(unquote(cp), gid_p) != 0)
264 + if (get_gid(__acl_unquote(cp), gid_p) != 0)
267 } else if (strncmp(cp, "flags:", 6) == 0) {
268 diff --git a/setfacl/setfacl.c b/setfacl/setfacl.c
269 index 81062a6..fb2d172 100644
270 --- a/setfacl/setfacl.c
271 +++ b/setfacl/setfacl.c
272 @@ -92,7 +92,7 @@ int promote_warning;
274 static const char *xquote(const char *str, const char *quote_chars)
276 - const char *q = quote(str, quote_chars);
277 + const char *q = __acl_quote(str, quote_chars);
279 fprintf(stderr, "%s: %s\n", progname, strerror(errno));
281 @@ -311,7 +311,7 @@ int next_file(const char *arg, seq_t seq)
284 if (strcmp(arg, "-") == 0) {
285 - while ((line = next_line(stdin)))
286 + while ((line = __acl_next_line(stdin)))
287 errors = walk_tree(line, walk_flags, 0, do_set, &args);
289 fprintf(stderr, _("%s: Standard input: %s\n"),