diff options
author | Brad King <brad.king@kitware.com> | 2009-11-06 15:54:10 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2009-11-06 15:54:10 (GMT) |
commit | 76f8504596c9b7c80458e72d514372a6e9d48d6b (patch) | |
tree | 9c059ae06cfdd7ac57bf8503d0469bc769f6c908 /Utilities | |
parent | d6fe0438c1d5c6ecd5ebc0377781175ce14ac251 (diff) | |
download | CMake-76f8504596c9b7c80458e72d514372a6e9d48d6b.zip CMake-76f8504596c9b7c80458e72d514372a6e9d48d6b.tar.gz CMake-76f8504596c9b7c80458e72d514372a6e9d48d6b.tar.bz2 |
libarchive: Initialize passwd/group lookup result
The "result" argument to functions get(pwu|grg)id_r and get(pw|gr)name_r
does not appear in the signatures provided on older platforms. We set
the pointer to the result memory in case the function ignores it, thus
ensuring initialization.
Diffstat (limited to 'Utilities')
-rw-r--r-- | Utilities/cmlibarchive/libarchive/archive_read_disk_set_standard_lookup.c | 2 | ||||
-rw-r--r-- | Utilities/cmlibarchive/libarchive/archive_write_disk_set_standard_lookup.c | 2 |
2 files changed, 4 insertions, 0 deletions
diff --git a/Utilities/cmlibarchive/libarchive/archive_read_disk_set_standard_lookup.c b/Utilities/cmlibarchive/libarchive/archive_read_disk_set_standard_lookup.c index 5ef4662..57d8228 100644 --- a/Utilities/cmlibarchive/libarchive/archive_read_disk_set_standard_lookup.c +++ b/Utilities/cmlibarchive/libarchive/archive_read_disk_set_standard_lookup.c @@ -199,6 +199,7 @@ lookup_uname_helper(struct name_cache *cache, id_t id) if (cache->buff == NULL) return (NULL); for (;;) { + result = &pwent; /* Old getpwuid_r ignores last argument. */ r = getpwuid_r((uid_t)id, &pwent, cache->buff, cache->buff_size, &result); if (r == 0) @@ -247,6 +248,7 @@ lookup_gname_helper(struct name_cache *cache, id_t id) if (cache->buff == NULL) return (NULL); for (;;) { + result = &grent; /* Old getgrgid_r ignores last argument. */ r = getgrgid_r((gid_t)id, &grent, cache->buff, cache->buff_size, &result); if (r == 0) diff --git a/Utilities/cmlibarchive/libarchive/archive_write_disk_set_standard_lookup.c b/Utilities/cmlibarchive/libarchive/archive_write_disk_set_standard_lookup.c index d83ac18..2869fb2 100644 --- a/Utilities/cmlibarchive/libarchive/archive_write_disk_set_standard_lookup.c +++ b/Utilities/cmlibarchive/libarchive/archive_write_disk_set_standard_lookup.c @@ -129,6 +129,7 @@ lookup_gid(void *private_data, const char *gname, gid_t gid) int r; for (;;) { + result = &grent; /* Old getgrnam_r ignores last argument. */ r = getgrnam_r(gname, &grent, buffer, bufsize, &result); if (r == 0) break; @@ -188,6 +189,7 @@ lookup_uid(void *private_data, const char *uname, uid_t uid) int r; for (;;) { + result = &pwent; /* Old getpwnam_r ignores last argument. */ r = getpwnam_r(uname, &pwent, buffer, bufsize, &result); if (r == 0) break; |