settings: Allow spaces in time settings before the optional unit

This commit is contained in:
Martin Willi 2014-07-07 15:53:49 +02:00
parent 0058e26cb0
commit a51c48eeaa
2 changed files with 7 additions and 2 deletions

View File

@ -23,6 +23,7 @@
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
#include <ctype.h>
#include "settings.h"
#include "settings_types.h"
@ -584,6 +585,10 @@ inline u_int32_t settings_value_as_time(char *value, u_int32_t def)
}
if (errno == 0)
{
while (isspace(*endptr))
{
endptr++;
}
switch (*endptr)
{
case 'd': /* time in days */

View File

@ -373,8 +373,8 @@ START_SETUP(setup_time_config)
" key0 = 5\n"
" key1 = 5s\n"
" key2 = 5m\n"
" key3 = 5h\n"
" key4 = 5d\n"
" key3 = 5 h\n"
" key4 = 5\td\n"
" empty = \"\"\n"
" none = \n"
" foo1 = bar\n"