summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormillert <millert@openbsd.org>1998-10-04 16:36:13 +0000
committermillert <millert@openbsd.org>1998-10-04 16:36:13 +0000
commit718eaf5ddac1d9bf0bc24d4066fe6bf47c99cd8b (patch)
treef8b0620d352b4d4b637c0b28d6a5e38c7ca3fc85
parentSay no to realloc leaks. (diff)
downloadwireguard-openbsd-718eaf5ddac1d9bf0bc24d4066fe6bf47c99cd8b.tar.xz
wireguard-openbsd-718eaf5ddac1d9bf0bc24d4066fe6bf47c99cd8b.zip
increase data size
-rw-r--r--sbin/savecore/savecore.c14
-rw-r--r--sbin/savecore/savecore_old.c14
2 files changed, 24 insertions, 4 deletions
diff --git a/sbin/savecore/savecore.c b/sbin/savecore/savecore.c
index 872387e174b..af60ce4a883 100644
--- a/sbin/savecore/savecore.c
+++ b/sbin/savecore/savecore.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: savecore.c,v 1.15 1998/09/24 06:24:20 millert Exp $ */
+/* $OpenBSD: savecore.c,v 1.16 1998/10/04 16:36:13 millert Exp $ */
/* $NetBSD: savecore.c,v 1.26 1996/03/18 21:16:05 leo Exp $ */
/*-
@@ -44,7 +44,7 @@ static char copyright[] =
#if 0
static char sccsid[] = "@(#)savecore.c 8.3 (Berkeley) 1/2/94";
#else
-static char rcsid[] = "$NetBSD: savecore.c,v 1.26 1996/03/18 21:16:05 leo Exp $";
+static char rcsid[] = "$OpenBSD: savecore.c,v 1.16 1998/10/04 16:36:13 millert Exp $";
#endif
#endif /* not lint */
@@ -52,7 +52,9 @@ static char rcsid[] = "$NetBSD: savecore.c,v 1.26 1996/03/18 21:16:05 leo Exp $"
#include <sys/stat.h>
#include <sys/mount.h>
#include <sys/syslog.h>
+#include <sys/types.h>
#include <sys/time.h>
+#include <sys/resource.h>
#include <dirent.h>
#include <errno.h>
@@ -142,10 +144,18 @@ main(argc, argv)
int argc;
char *argv[];
{
+ struct rlimit rl;
int ch;
openlog("savecore", LOG_PERROR, LOG_DAEMON);
+ /* Increase our data size to the max if we can. */
+ if (getrlimit(RLIMIT_DATA, &rl) == 0) {
+ rl.rlim_cur = rl.rlim_max;
+ if (setrlimit(RLIMIT_DATA, &rl) < 0)
+ syslog(LOG_WARNING, "can't set rlimit data size: %m");
+ }
+
while ((ch = getopt(argc, argv, "cdfN:vz")) != -1)
switch(ch) {
case 'c':
diff --git a/sbin/savecore/savecore_old.c b/sbin/savecore/savecore_old.c
index 5a060a5e718..2414338a10a 100644
--- a/sbin/savecore/savecore_old.c
+++ b/sbin/savecore/savecore_old.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: savecore_old.c,v 1.11 1998/09/24 06:24:20 millert Exp $ */
+/* $OpenBSD: savecore_old.c,v 1.12 1998/10/04 16:36:13 millert Exp $ */
/* $NetBSD: savecore_old.c,v 1.1.1.1 1996/03/16 10:25:11 leo Exp $ */
/*-
@@ -44,7 +44,7 @@ static char copyright[] =
#if 0
static char sccsid[] = "@(#)savecore.c 8.3 (Berkeley) 1/2/94";
#else
-static char rcsid[] = "$OpenBSD: savecore_old.c,v 1.11 1998/09/24 06:24:20 millert Exp $";
+static char rcsid[] = "$OpenBSD: savecore_old.c,v 1.12 1998/10/04 16:36:13 millert Exp $";
#endif
#endif /* not lint */
@@ -52,7 +52,9 @@ static char rcsid[] = "$OpenBSD: savecore_old.c,v 1.11 1998/09/24 06:24:20 mille
#include <sys/stat.h>
#include <sys/mount.h>
#include <sys/syslog.h>
+#include <sys/types.h>
#include <sys/time.h>
+#include <sys/resource.h>
#include <dirent.h>
#include <errno.h>
@@ -139,10 +141,18 @@ main(argc, argv)
int argc;
char *argv[];
{
+ struct rlimit rl;
int ch;
openlog("savecore", LOG_PERROR, LOG_DAEMON);
+ /* Increase our data size to the max if we can. */
+ if (getrlimit(RLIMIT_DATA, &rl) == 0) {
+ rl.rlim_cur = rl.rlim_max;
+ if (setrlimit(RLIMIT_DATA, &rl) < 0)
+ syslog(LOG_WARNING, "can't set rlimit data size: %m");
+ }
+
while ((ch = getopt(argc, argv, "cdfN:vz")) != -1)
switch(ch) {
case 'c':