settings: Allow spaces in time settings before the optional unit
This commit is contained in:
@@ -23,6 +23,7 @@
|
|||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
#include <ctype.h>
|
||||||
|
|
||||||
#include "settings.h"
|
#include "settings.h"
|
||||||
#include "settings_types.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)
|
if (errno == 0)
|
||||||
{
|
{
|
||||||
|
while (isspace(*endptr))
|
||||||
|
{
|
||||||
|
endptr++;
|
||||||
|
}
|
||||||
switch (*endptr)
|
switch (*endptr)
|
||||||
{
|
{
|
||||||
case 'd': /* time in days */
|
case 'd': /* time in days */
|
||||||
|
|||||||
@@ -373,8 +373,8 @@ START_SETUP(setup_time_config)
|
|||||||
" key0 = 5\n"
|
" key0 = 5\n"
|
||||||
" key1 = 5s\n"
|
" key1 = 5s\n"
|
||||||
" key2 = 5m\n"
|
" key2 = 5m\n"
|
||||||
" key3 = 5h\n"
|
" key3 = 5 h\n"
|
||||||
" key4 = 5d\n"
|
" key4 = 5\td\n"
|
||||||
" empty = \"\"\n"
|
" empty = \"\"\n"
|
||||||
" none = \n"
|
" none = \n"
|
||||||
" foo1 = bar\n"
|
" foo1 = bar\n"
|
||||||
|
|||||||
Reference in New Issue
Block a user