summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2009-11-05 21:29:10 (GMT)
committerBrad King <brad.king@kitware.com>2009-11-05 21:29:10 (GMT)
commitfe598550aa0a75e0bb379c9527a538229e703ef0 (patch)
treec06cb62f0160d9bc4a98e561165db3230ac33ae1
parenta9a48149714852b7c8ac60a2b5380aa097b0e3e5 (diff)
downloadCMake-fe598550aa0a75e0bb379c9527a538229e703ef0.zip
CMake-fe598550aa0a75e0bb379c9527a538229e703ef0.tar.gz
CMake-fe598550aa0a75e0bb379c9527a538229e703ef0.tar.bz2
libarchive: Define _XOPEN_SOURCE for get(pwu|grg)id_r
The commit "Fixed a few of the SunOS build errors in libarchive" changed the call to these functions to use the old signatures. Instead we now define _XOPEN_SOURCE to get the improved modern signatures.
-rw-r--r--Utilities/cmlibarchive/libarchive/archive_read_disk_set_standard_lookup.c16
-rw-r--r--Utilities/cmlibarchive/libarchive/archive_write_disk_set_standard_lookup.c16
2 files changed, 12 insertions, 20 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 dca7c2b..5ef4662 100644
--- a/Utilities/cmlibarchive/libarchive/archive_read_disk_set_standard_lookup.c
+++ b/Utilities/cmlibarchive/libarchive/archive_read_disk_set_standard_lookup.c
@@ -23,6 +23,10 @@
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
+#ifndef _XOPEN_SOURCE
+# define _XOPEN_SOURCE 500 /* getpwuid_r and getgrgid_r signatures */
+#endif
+
#include "archive_platform.h"
__FBSDID("$FreeBSD$");
@@ -186,7 +190,7 @@ static const char *
lookup_uname_helper(struct name_cache *cache, id_t id)
{
struct passwd pwent, *result;
- int r = 0;
+ int r;
if (cache->buff_size == 0) {
cache->buff_size = 256;
@@ -195,12 +199,8 @@ lookup_uname_helper(struct name_cache *cache, id_t id)
if (cache->buff == NULL)
return (NULL);
for (;;) {
-#if defined(__sun)
- result = getpwuid_r((uid_t)id, &pwent, cache->buff, cache->buff_size);
-#else
r = getpwuid_r((uid_t)id, &pwent,
cache->buff, cache->buff_size, &result);
-#endif
if (r == 0)
break;
if (r != ERANGE)
@@ -238,7 +238,7 @@ static const char *
lookup_gname_helper(struct name_cache *cache, id_t id)
{
struct group grent, *result;
- int r = 0;
+ int r;
if (cache->buff_size == 0) {
cache->buff_size = 256;
@@ -247,12 +247,8 @@ lookup_gname_helper(struct name_cache *cache, id_t id)
if (cache->buff == NULL)
return (NULL);
for (;;) {
-#if defined(__sun)
- result = getgrgid_r((gid_t)id, &grent, cache->buff, cache->buff_size);
-#else
r = getgrgid_r((gid_t)id, &grent,
cache->buff, cache->buff_size, &result);
-#endif
if (r == 0)
break;
if (r != ERANGE)
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 f77e3e3..d83ac18 100644
--- a/Utilities/cmlibarchive/libarchive/archive_write_disk_set_standard_lookup.c
+++ b/Utilities/cmlibarchive/libarchive/archive_write_disk_set_standard_lookup.c
@@ -23,6 +23,10 @@
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
+#ifndef _XOPEN_SOURCE
+# define _XOPEN_SOURCE 500 /* getpwuid_r and getgrgid_r signatures */
+#endif
+
#include "archive_platform.h"
__FBSDID("$FreeBSD: src/lib/libarchive/archive_write_disk_set_standard_lookup.c,v 1.4 2007/05/29 01:00:19 kientzle Exp $");
@@ -122,14 +126,10 @@ lookup_gid(void *private_data, const char *gname, gid_t gid)
size_t bufsize = 128;
char *buffer = _buffer;
struct group grent, *result;
- int r = 0;
+ int r;
for (;;) {
-#if defined(__sun)
- result = getgrnam_r(gname, &grent, buffer, bufsize);
-#else
r = getgrnam_r(gname, &grent, buffer, bufsize, &result);
-#endif
if (r == 0)
break;
if (r != ERANGE)
@@ -185,14 +185,10 @@ lookup_uid(void *private_data, const char *uname, uid_t uid)
size_t bufsize = 128;
char *buffer = _buffer;
struct passwd pwent, *result;
- int r = 0;
+ int r;
for (;;) {
-#if defined(__sun)
- result = getpwnam_r(uname, &pwent, buffer, bufsize);
-#else
r = getpwnam_r(uname, &pwent, buffer, bufsize, &result);
-#endif
if (r == 0)
break;
if (r != ERANGE)