summarylogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexander Kobel2018-11-15 10:54:01 +0100
committerAlexander Kobel2018-11-15 10:54:01 +0100
commitfb1f59c0f8b1dad88c92e73c76685af54c6d30f0 (patch)
tree14912088eadd6f040c642cb271db565e4967881f
parent6368dfe8d45a62bebbfb08a40032a95fba9768bd (diff)
downloadaur-fb1f59c0f8b1dad88c92e73c76685af54c6d30f0.tar.gz
renice xscreensaver to -20
-rw-r--r--.SRCINFO2
-rw-r--r--PKGBUILD2
-rw-r--r--xscreensaver-oom-protect.c6
3 files changed, 7 insertions, 3 deletions
diff --git a/.SRCINFO b/.SRCINFO
index d88b8c753559..75e94cc02baf 100644
--- a/.SRCINFO
+++ b/.SRCINFO
@@ -1,6 +1,6 @@
pkgbase = xscreensaver-oom-protect
pkgdesc = Protect xscreensaver from the out-of-memory killer
- pkgver = 1.0.0
+ pkgver = 1.0.1
pkgrel = 1
arch = x86_64
license = custom:WTFPL
diff --git a/PKGBUILD b/PKGBUILD
index a588be22285b..667f084113dd 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -1,7 +1,7 @@
# Maintainer: Alexander Kobel <a-kobel@a-kobel.de>
pkgname=xscreensaver-oom-protect
-pkgver=1.0.0
+pkgver=1.0.1
pkgrel=1
pkgdesc="Protect xscreensaver from the out-of-memory killer"
arch=('x86_64')
diff --git a/xscreensaver-oom-protect.c b/xscreensaver-oom-protect.c
index 389b09012288..476883502d38 100644
--- a/xscreensaver-oom-protect.c
+++ b/xscreensaver-oom-protect.c
@@ -28,11 +28,12 @@
#include <stdlib.h>
#include <string.h>
#include <linux/oom.h>
+#include <sys/resource.h>
int usage (char **argv) {
fprintf (stderr,
"Protect process <pid> from the OOM killer by setting its "
- "oom_score_adj to %d.\n"
+ "oom_score_adj to %d and its nice value to -20.\n"
"(TL;DR: try to avoid that an attacker types Alt+SysRq+F "
"repeatedly and ends up\n"
"with your logged-in session without the xscreensaver lock.)\n"
@@ -110,5 +111,8 @@ int main (int argc, char **argv) {
fprintf (f, "%d", OOM_SCORE_ADJ_MIN);
fclose (f);
+ if (setpriority (PRIO_PROCESS, pid, INT_MIN) != 0)
+ return errno;
+
return 0;
}