pkgsrc/devel/xulrunner10/patches/patch-aw
ryoon 7c73d57863 Import xulrunner-10.0.3 as devel/xulrunner
* Successor of devel/xulrunner, xulrunner-10.0.2.
* This is ESR (Extended Support Release) version.
* Fix security bugs
2012-03-15 08:58:26 +00:00

45 lines
1.2 KiB
Text

$NetBSD: patch-aw,v 1.1.1.1 2012/03/15 08:58:28 ryoon Exp $
--- xulrunner/stub/nsXULStub.cpp.orig 2012-03-09 22:20:39.000000000 +0000
+++ xulrunner/stub/nsXULStub.cpp
@@ -44,6 +44,29 @@
#include "nsILocalFile.h"
#include <stdarg.h>
+#if defined(__NetBSD__)
+#include <sys/resource.h>
+/*
+ * On netbsd-4, ulimit -n is 64 by default; too few for us.
+ */
+static void netbsd_fixrlimit(void) {
+ struct rlimit rlp;
+ if (getrlimit(RLIMIT_NOFILE, &rlp) == -1) {
+ fprintf(stderr, "warning: getrlimit failed\n");
+ return;
+ }
+ if (rlp.rlim_cur >= 512)
+ return;
+ if (rlp.rlim_max < 512) {
+ fprintf(stderr, "warning: hard limit of 'ulimit -n' too low\n");
+ rlp.rlim_cur = rlp.rlim_max;
+ }
+ else
+ rlp.rlim_cur = 512;
+ if (setrlimit(RLIMIT_NOFILE, &rlp) == -1)
+ fprintf(stderr, "warning: setrlimit failed\n");
+}
+#endif
#ifdef XP_WIN
#include <windows.h>
@@ -202,7 +225,9 @@ main(int argc, char **argv)
char greDir[MAXPATHLEN];
bool greFound = false;
-#if defined(XP_MACOSX)
+#if defined(__NetBSD__)
+ netbsd_fixrlimit();
+#elif defined(XP_MACOSX)
CFBundleRef appBundle = CFBundleGetMainBundle();
if (!appBundle)
return 1;