From: Robert Swiecki Date: Sat, 7 Oct 2017 10:37:26 +0000 (+0200) Subject: cmdline: better errors for setting rlimits X-Git-Tag: 1.9~25 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=6ada77d4cf22cc28ef1e228552c264e3e9e40b5e;p=platform%2Fupstream%2Fnsjail.git cmdline: better errors for setting rlimits --- diff --git a/cmdline.c b/cmdline.c index ac84809..f439b46 100644 --- a/cmdline.c +++ b/cmdline.c @@ -254,6 +254,9 @@ void cmdlineLogParams(struct nsjconf_t *nsjconf) __rlim64_t cmdlineParseRLimit(int res, const char *optarg, unsigned long mul) { + if (strcasecmp(optarg, "inf") == 0) { + return RLIM64_INFINITY; + } struct rlimit64 cur; if (getrlimit64(res, &cur) == -1) { PLOG_F("getrlimit(%d)", res); @@ -264,11 +267,8 @@ __rlim64_t cmdlineParseRLimit(int res, const char *optarg, unsigned long mul) if (strcasecmp(optarg, "max") == 0 || strcasecmp(optarg, "hard")) { return cur.rlim_max; } - if (strcasecmp(optarg, "inf") == 0) { - return RLIM64_INFINITY; - } if (utilIsANumber(optarg) == false) { - LOG_F("RLIMIT %d needs a numeric or 'max'/'def' value ('%s' provided)", res, + LOG_F("RLIMIT %d needs a numeric or 'max'/'hard'/'def'/'soft'/'inf' value ('%s' provided)", res, optarg); } __rlim64_t val = strtoull(optarg, NULL, 0) * mul;