OSDN Git Service

- avoid segfaulting when rlimit stack is set to low for gen_wctype by calling setrlim...
authorNed Ludd <solar@gentoo.org>
Sat, 26 Feb 2005 18:54:07 +0000 (18:54 -0000)
committerNed Ludd <solar@gentoo.org>
Sat, 26 Feb 2005 18:54:07 +0000 (18:54 -0000)
extra/locale/gen_wctype.c

index ab5c5dd..e0df4e8 100644 (file)
 #include <wchar.h>
 #include <ctype.h>
 
+#ifdef __linux__
+#include <sys/resource.h>
+#endif
+
 #ifndef _CTYPE_H
 #define _CTYPE_H
 #endif
@@ -243,6 +247,14 @@ int main(int argc, char **argv)
        static const char empty_slot[] = "empty_slot";
        int built = 0;
 
+#ifdef __linux__
+       struct rlimit limit;
+
+       limit.rlim_max = RLIM_INFINITY;
+       limit.rlim_cur = RLIM_INFINITY;
+       setrlimit(RLIMIT_STACK, &limit);
+#endif
+
 #define INIT_TYPENAME(X) typename[__CTYPE_##X] = "C_" #X
 
        for (i=0 ; i < 16 ; i++) {