From 8a3227b24e17e1b8fae9d2316b1e1f59b4bbb3c9 Mon Sep 17 00:00:00 2001 From: Petr Baudis <pasky@ucw.cz> Date: Wed, 7 Mar 2012 17:20:47 +0100 Subject: [PATCH] compctld limitmem: Remove superfluous sanity check --- compctld.c | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/compctld.c b/compctld.c index 690170c..f88132e 100644 --- a/compctld.c +++ b/compctld.c @@ -247,20 +247,12 @@ sockerror: size_t minuser, mincomp, maxcomp, total; memory_limits(&minuser, &mincomp, &maxcomp, &total); - /* Sanity check. */ - if (limit < 1024 || limit > total) { - syslog(LOG_WARNING, "limitmem: invalid limit (%zu)", limit); - mprintf(fd, "0 invalid limit value"); - close(fd); - continue; - } - if (limit < mincomp) { mprintf(fd, "-1 at least %zuM must remain available for computations.", mincomp / 1048576); close(fd); continue; } - if (total - limit < minuser) { + if (limit > total || total - limit < minuser) { mprintf(fd, "-2 at least %zuM must remain available for users.", minuser / 1048576); close(fd); continue; -- GitLab