summaryrefslogtreecommitdiff
path: root/time/tst-getdate.c
diff options
context:
space:
mode:
authorSiddhesh Poyarekar <siddhesh@redhat.com>2013-04-10 11:31:46 +0530
committerSiddhesh Poyarekar <siddhesh@redhat.com>2013-04-10 11:31:46 +0530
commitabe7f530bf5c741fe6f0658da7be59d8db168f7f (patch)
treeb57ba83c808a98b42b5b9d548afc51ae6962982d /time/tst-getdate.c
parent61c23e6234db0e94cd850e88536401910ac61516 (diff)
Accept leading and trailing spaces in getdate input string
Fixes #15346. The POSIX description of getdate allows for extra spaces in the getdate input string. __getdate_r uses strptime internally, which works fine with extra spaces between format strings (and hence within an input string) but not with leading and trailing spaces. So we trim off the leading and trailing spaces before we pass it on to strptime.
Diffstat (limited to 'time/tst-getdate.c')
-rw-r--r--time/tst-getdate.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/time/tst-getdate.c b/time/tst-getdate.c
index 7604e8394f..dc8ecf413a 100644
--- a/time/tst-getdate.c
+++ b/time/tst-getdate.c
@@ -31,6 +31,10 @@ static const struct
} tests [] =
{
{"21:01:10 1999-1-31", "Universal", 0, {10, 1, 21, 31, 0, 99, 0, 0, 0}},
+ {"21:01:10 1999-1-31", "Universal", 0, {10, 1, 21, 31, 0, 99, 0, 0, 0}},
+ {" 21:01:10 1999-1-31", "Universal", 0, {10, 1, 21, 31, 0, 99, 0, 0, 0}},
+ {"21:01:10 1999-1-31 ", "Universal", 0, {10, 1, 21, 31, 0, 99, 0, 0, 0}},
+ {" 21:01:10 1999-1-31 ", "Universal", 0, {10, 1, 21, 31, 0, 99, 0, 0, 0}},
{"21:01:10 1999-2-28", "Universal", 0, {10, 1, 21, 28, 1, 99, 0, 0, 0}},
{"16:30:46 2000-2-29", "Universal", 0, {46, 30,16, 29, 1, 100, 0, 0, 0}},
{"01-08-2000 05:06:07", "Europe/Berlin", 0, {7, 6, 5, 1, 7, 100, 0, 0, 0}}