mirror of
https://github.com/sheumann/hush.git
synced 2024-12-22 14:30:31 +00:00
According to bug #63, crond is unhappy with crontab lines that don't end in a
newline, or lines that have trailing spaces.
This commit is contained in:
parent
344ea471ef
commit
828548ab56
12
libbb/trim.c
12
libbb/trim.c
@ -29,14 +29,18 @@
|
|||||||
|
|
||||||
void trim(char *s)
|
void trim(char *s)
|
||||||
{
|
{
|
||||||
int len = strlen(s);
|
size_t len = strlen(s);
|
||||||
|
size_t lws;
|
||||||
|
|
||||||
/* trim trailing whitespace */
|
/* trim trailing whitespace */
|
||||||
while ( len > 0 && isspace(s[len-1]))
|
while (len && isspace(s[len-1])) --len;
|
||||||
s[--len]='\0';
|
|
||||||
|
|
||||||
/* trim leading whitespace */
|
/* trim leading whitespace */
|
||||||
memmove(s, &s[strspn(s, " \n\r\t\v")], len);
|
if(len) {
|
||||||
|
lws = strspn(s, " \n\r\t\v");
|
||||||
|
memmove(s, s + lws, len -= lws);
|
||||||
|
}
|
||||||
|
s[len] = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* END CODE */
|
/* END CODE */
|
||||||
|
@ -589,10 +589,8 @@ static void SynchronizeFile(const char *fileName)
|
|||||||
CronLine line;
|
CronLine line;
|
||||||
char *ptr;
|
char *ptr;
|
||||||
|
|
||||||
if (buf[0]) {
|
trim(buf);
|
||||||
buf[strlen(buf) - 1] = 0;
|
if (buf[0] == 0 || buf[0] == '#') {
|
||||||
}
|
|
||||||
if (buf[0] == 0 || buf[0] == '#' || buf[0] == ' ' || buf[0] == '\t') {
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (--maxEntries == 0) {
|
if (--maxEntries == 0) {
|
||||||
|
Loading…
Reference in New Issue
Block a user