From ad1b36291fe87ca9d647980e3afdc71344d66519 Mon Sep 17 00:00:00 2001 From: Tavian Barnes Date: Mon, 6 Nov 2023 10:06:41 -0500 Subject: ctx: Store the original and current RLIMIT_NOFILE --- src/ctx.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'src/ctx.c') diff --git a/src/ctx.c b/src/ctx.c index 561ecae..692f5c5 100644 --- a/src/ctx.c +++ b/src/ctx.c @@ -30,12 +30,10 @@ struct bfs_ctx *bfs_ctx_new(void) { trie_init(&ctx->files); - struct rlimit rl; - if (getrlimit(RLIMIT_NOFILE, &rl) != 0) { + if (getrlimit(RLIMIT_NOFILE, &ctx->orig_nofile) != 0) { goto fail; } - ctx->nofile_soft = rl.rlim_cur; - ctx->nofile_hard = rl.rlim_max; + ctx->cur_nofile = ctx->orig_nofile; ctx->users = bfs_users_new(); if (!ctx->users) { -- cgit v1.2.3