Skip to content

Commit

Permalink
mxqd: Check prerequisites
Browse files Browse the repository at this point in the history
  • Loading branch information
donald committed Apr 19, 2020
1 parent 1b3faf5 commit 338b12d
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions mxqd.c
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@

#include "mxqd_control.h"
#include "keywordset.h"
#include "parser.tab.h"

#ifndef MXQ_INITIAL_PATH
# define MXQ_INITIAL_PATH "/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin"
Expand Down Expand Up @@ -1421,6 +1422,19 @@ static int server_is_qualified(struct mxq_server *server, struct mxq_group *grou
return 0;
}

if (*group->prerequisites != 0) {
struct parser_context parser_context = {
.input = group->prerequisites,
.tags = server->prerequisites,
.pos=0,
.result = 0,
};
if (yyparse(&parser_context))
return 0; // syntax error in expression
if (parser_context.result == 0)
return 0; // avaluated to false
}

return (1);
}

Expand Down

0 comments on commit 338b12d

Please sign in to comment.