Limit rlim_max in rlimit_nofile_safe() to nr_open
authorDaan De Meyer <daan.j.demeyer@gmail.com>
Fri, 25 Aug 2023 11:55:36 +0000 (13:55 +0200)
committerDaan De Meyer <daan.j.demeyer@gmail.com>
Fri, 25 Aug 2023 12:26:11 +0000 (14:26 +0200)
commitf470dafddcd688c3ea6031d4bbcbf934fd094711
tree9829c69ba99d47f88f54ca04c926e5590f6f0be8
parentfbc6a7557120fbb97d781a5d2c640a3c55c3000f
Limit rlim_max in rlimit_nofile_safe() to nr_open

We might inherit a max rlim value that's larger than the kernel's
maximum (nr_open). This will cause setrlimit() to fail as the given
maximum is larger than the kernel's maximum. To get around this,
let's limit the max rlim we pass to rlimit() to the value of nr_open.

Should fix #28965
src/basic/rlimit-util.c