Sanity-check the stack-limit argument (limit needs to be > 0)

This commit is contained in:
Michael Stapelberg 2010-09-01 14:31:25 +02:00
parent 5403fac512
commit 53d6f476bc

View File

@ -393,18 +393,22 @@ new_container:
} }
| TOKNEWCONTAINER WHITESPACE TOKSTACKLIMIT WHITESPACE TOKSTACKLIMIT WHITESPACE NUMBER | TOKNEWCONTAINER WHITESPACE TOKSTACKLIMIT WHITESPACE TOKSTACKLIMIT WHITESPACE NUMBER
{ {
DLOG("stack-limit %d with val %d\n", $<number>5, $<number>7); if ($<number>7 <= 0) {
config.container_stack_limit = $<number>5; ELOG("Invalid stack-limit, need a limit which is > 0\n");
config.container_stack_limit_value = $<number>7; } else {
DLOG("stack-limit %d with val %d\n", $<number>5, $<number>7);
config.container_stack_limit = $<number>5;
config.container_stack_limit_value = $<number>7;
/* See the comment above */ /* See the comment above */
Workspace *ws; Workspace *ws;
TAILQ_FOREACH(ws, workspaces, workspaces) { TAILQ_FOREACH(ws, workspaces, workspaces) {
if (ws->table == NULL) if (ws->table == NULL)
continue; continue;
Container *con = ws->table[0][0]; Container *con = ws->table[0][0];
con->stack_limit = config.container_stack_limit; con->stack_limit = config.container_stack_limit;
con->stack_limit_value = config.container_stack_limit_value; con->stack_limit_value = config.container_stack_limit_value;
}
} }
} }
; ;