summaryrefslogtreecommitdiff
path: root/lang/tcl/patches/patch-unix_tclUnixCompat.c
blob: 9d81e819c7fd2d10995549c1042f209a4453c757 (plain)
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.1 2012/12/29 13:49:12 bsiegert Exp $

This is needed on MirBSD, which does not have the required sysconf
constants.

--- unix/tclUnixCompat.c.orig	Thu Dec 13 16:53:10 2012
+++ 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 = 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 = ckalloc(tsdPtr->pbuflen);
 	Tcl_CreateThreadExitHandler(FreePwBuf, NULL);
     }
@@ -380,10 +388,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 = ckalloc(tsdPtr->gbuflen);
 	Tcl_CreateThreadExitHandler(FreeGrBuf, NULL);
     }
@@ -460,10 +472,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 = ckalloc(tsdPtr->gbuflen);
 	Tcl_CreateThreadExitHandler(FreeGrBuf, NULL);
     }