Cron fixes (#1884)
* Fix cron values >32 * Fix crontab description items order
This commit is contained in:
parent
b09cac058a
commit
92cfbb45c3
|
@ -53,7 +53,7 @@ static uint64_t lcron_parsepart(lua_State *L, char *str, char **end, uint8_t min
|
||||||
if (val < min || val > max) {
|
if (val < min || val > max) {
|
||||||
return luaL_error(L, "invalid spec (val %d out of range %d..%d)", val, min, max);
|
return luaL_error(L, "invalid spec (val %d out of range %d..%d)", val, min, max);
|
||||||
}
|
}
|
||||||
res |= (1 << (val - min));
|
res |= (uint64_t)1 << (val - min);
|
||||||
if (**end != ',') break;
|
if (**end != ',') break;
|
||||||
str = *end + 1;
|
str = *end + 1;
|
||||||
}
|
}
|
||||||
|
@ -67,11 +67,11 @@ static int lcron_parsedesc(lua_State *L, char *str, struct cronent_desc *desc) {
|
||||||
if (*s != ' ') return luaL_error(L, "invalid spec (separator @%d)", s - str);
|
if (*s != ' ') return luaL_error(L, "invalid spec (separator @%d)", s - str);
|
||||||
desc->hour = lcron_parsepart(L, s + 1, &s, 0, 23);
|
desc->hour = lcron_parsepart(L, s + 1, &s, 0, 23);
|
||||||
if (*s != ' ') return luaL_error(L, "invalid spec (separator @%d)", s - str);
|
if (*s != ' ') return luaL_error(L, "invalid spec (separator @%d)", s - str);
|
||||||
desc->dow = lcron_parsepart(L, s + 1, &s, 0, 6);
|
|
||||||
if (*s != ' ') return luaL_error(L, "invalid spec (separator @%d)", s - str);
|
|
||||||
desc->dom = lcron_parsepart(L, s + 1, &s, 1, 31);
|
desc->dom = lcron_parsepart(L, s + 1, &s, 1, 31);
|
||||||
if (*s != ' ') return luaL_error(L, "invalid spec (separator @%d)", s - str);
|
if (*s != ' ') return luaL_error(L, "invalid spec (separator @%d)", s - str);
|
||||||
desc->mon = lcron_parsepart(L, s + 1, &s, 1, 12);
|
desc->mon = lcron_parsepart(L, s + 1, &s, 1, 12);
|
||||||
|
if (*s != ' ') return luaL_error(L, "invalid spec (separator @%d)", s - str);
|
||||||
|
desc->dow = lcron_parsepart(L, s + 1, &s, 0, 6);
|
||||||
if (*s != 0) return luaL_error(L, "invalid spec (trailing @%d)", s - str);
|
if (*s != 0) return luaL_error(L, "invalid spec (trailing @%d)", s - str);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue