-
Notifications
You must be signed in to change notification settings - Fork 724
Closed
Description
Documentation says:
Lines 176 to 177 in 6123083
| /// A value of `None` indicates the value equals to `RLIM_INFINITY` which means | |
| /// there is no limit. |
but code unconditionally returns Some():
Lines 209 to 212 in 6123083
| Errno::result(res).map(|_| { | |
| let rlimit { rlim_cur, rlim_max } = unsafe { old_rlim.assume_init() }; | |
| (Some(rlim_cur), Some(rlim_max)) | |
| }) |
This documentation is leftover from the old PR code which did return None:
Errno::result(res).map(|_| {
(if rlim.rlim_cur != RLIM_INFINITY { Some(rlim.rlim_cur) } else { None },
if rlim.rlim_max != RLIM_INFINITY { Some(rlim.rlim_max) } else { None })
})... but the new PR removed that branch.
It would be nice to not return Option from getrlimit at least, since it makes the caller code more annoying when we only want to call setrlimit when we need to, which requires comparing the returned soft limit vs the returned hard limit. And if getrlimit is changed to not special-case INFINITY, the special-case might as well be removed from setrlimit too so that one doesn't need to Some()-wrap the values when passing them from getrlimit to setrlimit.
Metadata
Metadata
Assignees
Labels
No labels