Skip to content

Commit

Permalink
Fail if --cg-mem or --cg-timing is given without --cg
Browse files Browse the repository at this point in the history
  • Loading branch information
gollux committed Mar 26, 2018
1 parent cd542d6 commit d99465c
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions isolate.c
Original file line number Diff line number Diff line change
Expand Up @@ -950,6 +950,7 @@ int
main(int argc, char **argv)
{
int c;
int require_cg = 0;
char *sep;
enum opt_code mode = 0;

Expand Down Expand Up @@ -1042,9 +1043,11 @@ main(int argc, char **argv)
break;
case OPT_CG_MEM:
cg_memory_limit = atoi(optarg);
require_cg = 1;
break;
case OPT_CG_TIMING:
cg_timing = 1;
require_cg = 1;
break;
case OPT_SHARE_NET:
share_net = 1;
Expand All @@ -1068,6 +1071,9 @@ main(int argc, char **argv)
return 0;
}

if (require_cg && !cg_enable)
usage("Options related to control groups require --cg to be set.\n");

if (geteuid())
die("Must be started as root");
if (getegid() && setegid(0) < 0)
Expand Down

0 comments on commit d99465c

Please sign in to comment.