commit - 296611672d3a242111a160c45afb7ac81a01b326
commit + abe89edb698f9d165b74d1fe146b13fade5b52bd
blob - 8909ba126c854b6eb163a75d2e039487e7294c58
blob + 892a54d71ecfa0e0dc9b036bdc334a9cbb1e4225
--- gotd/gotd.c
+++ gotd/gotd.c
#include <sys/socket.h>
#include <sys/un.h>
#include <sys/wait.h>
+#include <sys/resource.h>
#include <fcntl.h>
#include <err.h>
fatal("unveil");
}
+static void
+set_max_datasize(void)
+{
+ struct rlimit rl;
+
+ if (getrlimit(RLIMIT_DATA, &rl) != 0)
+ return;
+
+ rl.rlim_cur = rl.rlim_max;
+ setrlimit(RLIMIT_DATA, &rl);
+}
+
int
main(int argc, char **argv)
{
/* NOTREACHED */
break;
case PROC_REPO_READ:
+ set_max_datasize();
#ifndef PROFILE
if (pledge("stdio rpath recvfd unveil", NULL) == -1)
err(1, "pledge");
/* NOTREACHED */
exit(0);
case PROC_REPO_WRITE:
+ set_max_datasize();
#ifndef PROFILE
if (pledge("stdio rpath recvfd unveil", NULL) == -1)
err(1, "pledge");