diff options
author | Tavian Barnes <tavianator@tavianator.com> | 2023-11-06 10:06:41 -0500 |
---|---|---|
committer | Tavian Barnes <tavianator@tavianator.com> | 2023-11-06 10:10:08 -0500 |
commit | ad1b36291fe87ca9d647980e3afdc71344d66519 (patch) | |
tree | ddbbc5eabf62ff2e2e3266ea6fdcd7e7f37d9a18 /src/ctx.c | |
parent | 816574513e0e163aff9f183721697f157eb158fa (diff) | |
download | bfs-ad1b36291fe87ca9d647980e3afdc71344d66519.tar.xz |
ctx: Store the original and current RLIMIT_NOFILE
Diffstat (limited to 'src/ctx.c')
-rw-r--r-- | src/ctx.c | 6 |
1 files changed, 2 insertions, 4 deletions
@@ -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) { |