Skip to content

Commit

Permalink
Cron fixes (#1884)
Browse files Browse the repository at this point in the history
* Fix cron values >32

* Fix crontab description items order
  • Loading branch information
djphoenix authored and devsaurus committed Mar 27, 2017
1 parent b09cac0 commit 92cfbb4
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions app/modules/cron.c
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ static uint64_t lcron_parsepart(lua_State *L, char *str, char **end, uint8_t min
if (val < min || val > 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;
str = *end + 1;
}
Expand All @@ -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);
desc->hour = lcron_parsepart(L, s + 1, &s, 0, 23);
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);
if (*s != ' ') return luaL_error(L, "invalid spec (separator @%d)", s - str);
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);
return 0;
}
Expand Down

0 comments on commit 92cfbb4

Please sign in to comment.