projects
/
platform
/
upstream
/
systemd.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
915b1d0
)
rlimit: don't assume getrlimit() always succeeds
author
Lennart Poettering
<lennart@poettering.net>
Thu, 21 Sep 2017 17:37:11 +0000
(19:37 +0200)
committer
Lennart Poettering
<lennart@poettering.net>
Fri, 22 Sep 2017 13:28:05 +0000
(15:28 +0200)
In times of seccomp it might very well fail, and given that we return
failures from this function anyway, let's also propagate getrlimit()
failures, just to be safe.
src/basic/rlimit-util.c
patch
|
blob
|
history
diff --git
a/src/basic/rlimit-util.c
b/src/basic/rlimit-util.c
index
ca834df
..
5c41429
100644
(file)
--- a/
src/basic/rlimit-util.c
+++ b/
src/basic/rlimit-util.c
@@
-42,7
+42,8
@@
int setrlimit_closest(int resource, const struct rlimit *rlim) {
/* So we failed to set the desired setrlimit, then let's try
* to get as close as we can */
- assert_se(getrlimit(resource, &highest) == 0);
+ if (getrlimit(resource, &highest) < 0)
+ return -errno;
fixed.rlim_cur = MIN(rlim->rlim_cur, highest.rlim_max);
fixed.rlim_max = MIN(rlim->rlim_max, highest.rlim_max);