summaryrefslogtreecommitdiff
path: root/lib/libc/gen
diff options
context:
space:
mode:
authorStuart Henderson <sthen@cvs.openbsd.org>2011-04-25 20:10:11 +0000
committerStuart Henderson <sthen@cvs.openbsd.org>2011-04-25 20:10:11 +0000
commita3f8423a9922faa1e25d4f8d60c79b2ac71ecf22 (patch)
tree5182a5541776af045c31c69198893dbbfca4b196 /lib/libc/gen
parent1a02234ed70255e55ade6d0d28a9087622447d21 (diff)
Teach sysconf(_SC_GETGR_R_SIZE_MAX) the correct size of a buffer for the
reentrant getgrent functions (getgrgid_r, getgrnam_r). seems reasonable to millert@, ok deraadt@
Diffstat (limited to 'lib/libc/gen')
-rw-r--r--lib/libc/gen/getgrent.c4
-rw-r--r--lib/libc/gen/sysconf.c5
2 files changed, 5 insertions, 4 deletions
diff --git a/lib/libc/gen/getgrent.c b/lib/libc/gen/getgrent.c
index 0acf4e8183c..080ea55cc8b 100644
--- a/lib/libc/gen/getgrent.c
+++ b/lib/libc/gen/getgrent.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: getgrent.c,v 1.36 2009/12/19 22:41:39 schwarze Exp $ */
+/* $OpenBSD: getgrent.c,v 1.37 2011/04/25 20:10:10 sthen Exp $ */
/*
* Copyright (c) 1989, 1993
* The Regents of the University of California. All rights reserved.
@@ -53,7 +53,7 @@ static struct group_storage {
#define MAXLINELENGTH 1024
char line[MAXLINELENGTH];
} gr_storage;
-#define GETGR_R_SIZE_MAX (1024+200*sizeof(char*))
+#define GETGR_R_SIZE_MAX _GR_BUF_LEN
/* File pointers are locked with the 'gr' mutex */
_THREAD_PRIVATE_KEY(gr);
diff --git a/lib/libc/gen/sysconf.c b/lib/libc/gen/sysconf.c
index ce4f89a0b44..a7cefaa689b 100644
--- a/lib/libc/gen/sysconf.c
+++ b/lib/libc/gen/sysconf.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: sysconf.c,v 1.12 2010/10/28 02:06:00 deraadt Exp $ */
+/* $OpenBSD: sysconf.c,v 1.13 2011/04/25 20:10:10 sthen Exp $ */
/*-
* Copyright (c) 1993
* The Regents of the University of California. All rights reserved.
@@ -39,6 +39,7 @@
#include <sys/vmmeter.h>
#include <errno.h>
+#include <grp.h>
#include <pwd.h>
#include <unistd.h>
@@ -119,7 +120,7 @@ sysconf(int name)
return (_POSIX_THREAD_SAFE_FUNCTIONS);
case _SC_GETGR_R_SIZE_MAX:
- return (_PW_BUF_LEN);
+ return (_GR_BUF_LEN);
case _SC_GETPW_R_SIZE_MAX:
return (_PW_BUF_LEN);