diff options
author | Andreas Gruenbacher <agruenba@redhat.com> | 2016-03-07 20:23:18 +0100 |
---|---|---|
committer | Andreas Gruenbacher <agruenba@redhat.com> | 2016-03-07 20:23:18 +0100 |
commit | ea5590f26ba44341452722b19397d40d33c66ebf (patch) | |
tree | 347767e057e2ebbb4ce145e5ae5f2a28a6dde49b | |
parent | 977728c6f3640a1ffc7ceecc03781058cc328585 (diff) | |
download | acl-ea5590f26ba44341452722b19397d40d33c66ebf.tar.gz |
libtestlookup: Add missing EXPORT and static declarations
-rw-r--r-- | test/test_group.c | 18 | ||||
-rw-r--r-- | test/test_passwd.c | 18 |
2 files changed, 22 insertions, 14 deletions
diff --git a/test/test_group.c b/test/test_group.c index 0245d0c..00c0027 100644 --- a/test/test_group.c +++ b/test/test_group.c @@ -12,15 +12,15 @@ static char grfile[PATH_MAX]; static void setup_grfile() __attribute__((constructor)); -void setup_grfile() { +static void setup_grfile() { snprintf(grfile, sizeof(grfile), "%s/%s", BASEDIR, TEST_GROUP); } #define ALIGN_MASK(x, mask) (((x) + (mask)) & ~(mask)) #define ALIGN(x, a) ALIGN_MASK(x, (typeof(x))(a) - 1) -int test_getgrent_r(FILE *file, struct group *grp, char *buf, - size_t buflen, struct group **result) +static int test_getgrent_r(FILE *file, struct group *grp, char *buf, + size_t buflen, struct group **result) { char *line, *str, *remain; int count, index = 0; @@ -76,10 +76,10 @@ int test_getgrent_r(FILE *file, struct group *grp, char *buf, return 0; } -int test_getgr_match(struct group *grp, char *buf, size_t buflen, - struct group **result, - int (*match)(const struct group *, const void *), - const void *data) +static int test_getgr_match(struct group *grp, char *buf, size_t buflen, + struct group **result, + int (*match)(const struct group *, const void *), + const void *data) { FILE *file; struct group *_result; @@ -116,12 +116,14 @@ static int match_name(const struct group *grp, const void *data) return !strcmp(grp->gr_name, name); } +EXPORT int getgrnam_r(const char *name, struct group *grp, char *buf, size_t buflen, struct group **result) { return test_getgr_match(grp, buf, buflen, result, match_name, name); } +EXPORT struct group *getgrnam(const char *name) { static char buf[16384]; @@ -138,12 +140,14 @@ static int match_gid(const struct group *grp, const void *data) return grp->gr_gid == gid; } +EXPORT int getgrgid_r(gid_t gid, struct group *grp, char *buf, size_t buflen, struct group **result) { return test_getgr_match(grp, buf, buflen, result, match_gid, &gid); } +EXPORT struct group *getgrgid(gid_t gid) { static char buf[16384]; diff --git a/test/test_passwd.c b/test/test_passwd.c index e05239e..890e041 100644 --- a/test/test_passwd.c +++ b/test/test_passwd.c @@ -12,15 +12,15 @@ static char pwfile[PATH_MAX]; static void setup_pwfile() __attribute__((constructor)); -void setup_pwfile() { +static void setup_pwfile() { snprintf(pwfile, sizeof(pwfile), "%s/%s", BASEDIR, TEST_PASSWD); } #define ALIGN_MASK(x, mask) (((x) + (mask)) & ~(mask)) #define ALIGN(x, a) ALIGN_MASK(x, (typeof(x))(a) - 1) -int test_getpwent_r(FILE *file, struct passwd *pwd, char *buf, - size_t buflen, struct passwd **result) +static int test_getpwent_r(FILE *file, struct passwd *pwd, char *buf, + size_t buflen, struct passwd **result) { char *str, *line; int index = 0; @@ -70,10 +70,10 @@ int test_getpwent_r(FILE *file, struct passwd *pwd, char *buf, return 0; } -int test_getpw_match(struct passwd *pwd, char *buf, size_t buflen, - struct passwd **result, - int (*match)(const struct passwd *, const void *), - const void *data) +static int test_getpw_match(struct passwd *pwd, char *buf, size_t buflen, + struct passwd **result, + int (*match)(const struct passwd *, const void *), + const void *data) { FILE *file; struct passwd *_result; @@ -111,12 +111,14 @@ static int match_name(const struct passwd *pwd, const void *data) return !strcmp(pwd->pw_name, name); } +EXPORT int getpwnam_r(const char *name, struct passwd *pwd, char *buf, size_t buflen, struct passwd **result) { return test_getpw_match(pwd, buf, buflen, result, match_name, name); } +EXPORT struct passwd *getpwnam(const char *name) { static char buf[16384]; @@ -133,12 +135,14 @@ static int match_uid(const struct passwd *pwd, const void *data) return pwd->pw_uid == uid; } +EXPORT int getpwuid_r(uid_t uid, struct passwd *pwd, char *buf, size_t buflen, struct passwd **result) { return test_getpw_match(pwd, buf, buflen, result, match_uid, &uid); } +EXPORT struct passwd *getpwuid(uid_t uid) { static char buf[16384]; |