1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
|
$NetBSD: patch-unix_tclUnixCompat.c,v 1.2 2021/01/20 20:38:49 adam Exp $
This is needed on MirBSD, which does not have the required sysconf
constants.
--- unix/tclUnixCompat.c.orig 2020-12-11 17:46:23.000000000 +0000
+++ unix/tclUnixCompat.c
@@ -197,10 +197,14 @@ TclpGetPwNam(
*/
if (tsdPtr->pbuf == NULL) {
+#ifdef _SC_GETPW_R_SIZE_MAX
tsdPtr->pbuflen = (int) sysconf(_SC_GETPW_R_SIZE_MAX);
if (tsdPtr->pbuflen < 1) {
+#endif
tsdPtr->pbuflen = 1024;
+#ifdef _SC_GETPW_R_SIZE_MAX
}
+#endif
tsdPtr->pbuf = (char *)ckalloc(tsdPtr->pbuflen);
Tcl_CreateThreadExitHandler(FreePwBuf, NULL);
}
@@ -277,10 +281,14 @@ TclpGetPwUid(
*/
if (tsdPtr->pbuf == NULL) {
+#ifdef _SC_GETPW_R_SIZE_MAX
tsdPtr->pbuflen = (int) sysconf(_SC_GETPW_R_SIZE_MAX);
if (tsdPtr->pbuflen < 1) {
+#endif
tsdPtr->pbuflen = 1024;
+#ifdef _SC_GETPW_R_SIZE_MAX
}
+#endif
tsdPtr->pbuf = (char *)ckalloc(tsdPtr->pbuflen);
Tcl_CreateThreadExitHandler(FreePwBuf, NULL);
}
@@ -381,10 +389,14 @@ TclpGetGrNam(
*/
if (tsdPtr->gbuf == NULL) {
+#ifdef _SC_GETGR_R_SIZE_MAX
tsdPtr->gbuflen = (int) sysconf(_SC_GETGR_R_SIZE_MAX);
if (tsdPtr->gbuflen < 1) {
+#endif
tsdPtr->gbuflen = 1024;
+#ifdef _SC_GETGR_R_SIZE_MAX
}
+#endif
tsdPtr->gbuf = (char *)ckalloc(tsdPtr->gbuflen);
Tcl_CreateThreadExitHandler(FreeGrBuf, NULL);
}
@@ -461,10 +473,14 @@ TclpGetGrGid(
*/
if (tsdPtr->gbuf == NULL) {
+#ifdef _SC_GETGR_R_SIZE_MAX
tsdPtr->gbuflen = (int) sysconf(_SC_GETGR_R_SIZE_MAX);
if (tsdPtr->gbuflen < 1) {
+#endif
tsdPtr->gbuflen = 1024;
+#ifdef _SC_GETGR_R_SIZE_MAX
}
+#endif
tsdPtr->gbuf = (char *)ckalloc(tsdPtr->gbuflen);
Tcl_CreateThreadExitHandler(FreeGrBuf, NULL);
}
|