From 300a18fc5617bb837022b4031884f3b855ed79c6 Mon Sep 17 00:00:00 2001
From: Petr Baudis <pasky@ucw.cz>
Date: Fri, 16 Mar 2012 01:47:20 +0100
Subject: [PATCH] compctl limit_mem(): Print an explanation in case of 0-class
 error

---
 compctl.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/compctl.c b/compctl.c
index 52b3bfa..f1bba58 100644
--- a/compctl.c
+++ b/compctl.c
@@ -160,8 +160,12 @@ limit_mem(size_t limit)
 	snprintf(cmd, sizeof(cmd), "limitmem %zu", limit * 1048576);
 	char *line = daemon_chat(cmd);
 	if (line[0] != '1') {
-		/* TODO: Error message postprocessing. */
+		/* TODO: More error message postprocessing. */
 		fprintf(stderr, "%s\n", *line ? line : "unexpected hangup");
+		if (line[0] == '0') {
+			fprintf(stderr, "Most likely, the computations are already using too much memory.\n"
+					"Consider stopping some of them first.\n");
+		}
 		exit(EXIT_FAILURE);
 	}
 	free(line);
-- 
GitLab